- Joined
- Nov 19, 2019
- Messages
- 80
This module uses Android's Storage Access Framework to export/import strings to files. It is useful for letting the user backup their saves on their hard drive or cloud storage apps they have installed. The storage access framework requires Android 4.4. Also some TV boxes have SAF stripped out too! :< If the device doesn't support it exporter.getSupported() will return false. Then I like to fallback to using the clipboard to copy/paste save files. Being able to backup my save is always a must for me.
exportString:Void(content:String, name:String, mime:String)
Install:
License: zlib/libpng (see included license.txt)
exportString:Void(content:String, name:String, mime:String)
content = text content of file to make
name = name of file to create
mime = mime type of file to create. (Eg: "text/plain", "text/*", "*/*") (Note: Storage Access framework doesn't seem to work well with mime types it doesn't recognize.)
beginImportString:Void(mime:String)mime = mime type of file to filter for. (Eg: "text/plain", "text/*", "*/*") (Note: Storage Access framework doesn't seem to work well with mime types it doesn't recognize.)
getImportedString:String()get the string from the selected file after beginImportString is called and getImportSuccess returns IMPORT_CODE_SUCCESS.
deleteImportedString:Void()Clean up after your done importing the string.
getImportSuccess:Int()returns the state of importing a string.
Const IMPORT_CODE_NOT_DONE:Int = 2
Const IMPORT_CODE_SUCCESS:Int = 0
Const IMPORT_CODE_CANCELED:Int = 3
Const IMPORT_CODE_FAILED:Int = 4
getSupported:Bool()returns if the export/import functions are supported.
Demo: The included demo.cxs will open the system file browser to export or import a string when you tap the screen. It displays the imported string. If it is not supported it will just display that it's not supported.Install:
- extract the zip file inside the modules_ext folder inside your Cerberus X installation folder.
- place ExportStringsActivity.java in this path Cerberus/targets/android/template/gradletemplate/app/src/main/java/com/grantojanen/modules/ExportStringsActivity.java
- Add this line to the top of your .cxs file
Code:
#ANDROID_MANIFEST_APPLICATION="<activity android:name=~qcom.grantojanen.modules.ExportStringsActivity~q android:configChanges=~qorientation|keyboardHidden|screenSize|navigation|keyboard|screenLayout|smallestScreenSize~q/>"
License: zlib/libpng (see included license.txt)
Attachments
Last edited: