I would like to know what is the analogue of the FileStream (Flash) class in haxe, I create the android application and I need to read and write to the files in the installation directory of the application ?
On Android, applications are not extracted – the OS keeps it inside a zipped APK, so there is no writable installation directory
However, you can use openfl.net.SharedObject
, which writes to Android application storage, or you can use a system directory (lime.system.System
has a few you can check) and use sys.Filesystem
or sys.io.File
to write there
Actually some files are extracted (for example *.so
libs).
There is Context.getFilesDir()
link to get folder, where app store all data (including shared preferences).
Typical application folder looks like:
/data/data/<package_name>
|- cache <- android put various cache files here
|- databases <- SQLite databases
|- files <- user files
|- shared_prefs <- shared preferences
|- libs <- .so files
P. S. In some cases some particular folder (eg files
) may not exists, so you must create it by yourself.
lime.system.System.applicationStorageDirectory
should work for android (internally it calls SDL_GetPrefPath()
, which call SDL_AndroidGetInternalStoragePath()
, which probably calls Context.getFilesDir()