Python-for-Android
Fleeting- External reference: https://python-for-android.readthedocs.io/en/latest/apis.html
- External reference: https://python-for-android.readthedocs.io/en/develop/services.html
services
You can optionally specify the following parameters: :foreground for launching a service as an Android foreground service :sticky for launching a service that gets restarted by the Android OS on exit/error
— https://python-for-android.readthedocs.io/en/develop/services.html
command with all the optional parameters included would be: –service=myservice:services/myservice.py:foreground:sticky
— https://python-for-android.readthedocs.io/en/develop/services.html
you shouldn’t just save to the current directory, and not hardcode sdcard or some other path either - it might differ per device.
— https://python-for-android.readthedocs.io/en/latest/apis.html
from android.storage import app_storage_path settings_path = app_storage_path()
from android.storage import primary_external_storage_path primary_ext_storage = primary_external_storage_path()
from android.storage import secondary_external_storage_path secondary_ext_storage = secondary_external_storage_path()
— https://python-for-android.readthedocs.io/en/latest/apis.html
Only the internal storage is always accessible with no additional permissions. For both primary and secondary external storage, you need to obtain Permission.WRITE_EXTERNAL_STORAGE and the user may deny it.
— https://python-for-android.readthedocs.io/en/latest/apis.html
may only allow your app to write to the common pre-existing folders like “Music”, “Documents”, and so on
— https://python-for-android.readthedocs.io/en/latest/apis.html
need to request runtime permissions to access the SD card, the camera, and other things.
— https://python-for-android.readthedocs.io/en/latest/apis.html
from android.permissions import request_permissions, Permission request_permissions([Permission.WRITE_EXTERNAL_STORAGE])
— https://python-for-android.readthedocs.io/en/latest/apis.html
Notes linking here
- a python runtime on android (blog)