Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - add files into APK package?

Tags:

android

is it possible to add to my apk file some XML file storing program version, update path and other useful data (note: I don't mean Android XML file). All I want to is this file to be unpacked somewhere to local data folder and I will use it for comparing version info installed locally and on the server in case of updates.

I am asking - is it possible to add to apk some other file?

Thanks

like image 975
Waypoint Avatar asked Mar 23 '11 09:03

Waypoint


1 Answers

The assets/ folder in apk is intended to store any extra user files in any formats. They will be included to apk automatically on compilation stage and can be accessed from the app using getAssets() function. For example:

    final InputStream is = getResources().getAssets().open("some_file.xml")

It is even unnecessary to copy them to some local folder to read them.

like image 87
GrAnd Avatar answered Oct 09 '22 06:10

GrAnd