How to Include Data Files with the App's APK

How to include data files with the app's APK?

You can save you files in \res\raw and write the code to store this files to the desired locations if it does not exist when the app start.

Check this to access the internal memory and sdcard

and access the raw file using the following

InputStream databaseInputStream = getResources().openRawResource(R.raw.yourfile);

How to package and access extra files inside my apk

You can add them to the res/raw/ folder.

Check this to learn how to use it.

How to store initial data in android apk file?

did you look at res/assets?

I assume that you probably have some sort of json/xml data that you want to pre-package with your app if so, then load the json/xml into the res/assets and it'll just be a file included with your apk.

Ref

https://developer.android.com/guide/topics/resources/accessing-resources.html

How to insert unique data into an Android APK package with each download?

An APK is fundamentally an archive.

I think that you should be able to unzip, edit and zip it again without changing its signature, as you can see from this detailed guide

In order to put a unique code inside your app, you could use the assets folder creating a txt or json file containing that code.

Then, you can retrieve the unique code inside your app by reading the assets folder programmatically.

How do I correctly include data folders into an APK with Buildozer? FileNotFoundError

Maybe try playing audio files using Kivy's own SoundLoader function. Like this:

from kivy.core.audio import SoundLoader

sound = SoundLoader.load('mytest.wav')
if sound:
print("Sound found at %s" % sound.source)
print("Sound is %.3f seconds" % sound.length)
sound.play()

More information can be found here.

Also, try to use os.path.join as @NameKhan72 has mentioned in his answer. Don't forget to import os first. Clean up the Buildozer folder (in your project folder) before rebuilding apk again.



Related Topics



Leave a reply



Submit