Outils pour utilisateurs

Outils du site


kivy_android_service

Ceci est une ancienne révision du document !


Kivy: Android Service

Pourquoi utiliser un service android ?

Les applications Android se mettent en pause, lors du verrouillage de l'écran, ou de la réduction de la fenêtre de l'application.
Pour avoir un script qui tourne en arrière plan, il faut utiliser un service.

Ressources

Extrait: python-for-android supports the use of Android Services, background tasks running in separate processes. These are the closest Android equivalent to multiprocessing on e.g. desktop platforms, and it is not possible to use normal multiprocessing on Android. Services are also the only way to run code when your app is not currently opened by the user.

Services must be declared when building your APK. Each one will have its own main.py file with the Python script to be run. Please note that python-for-android explicitly runs services as separated processes by having a colon “:” in the beginning of the name assigned to the android:process attribute of the AndroidManifest.xml file. This is not the default behavior, see Android service documentation. You can communicate with the service process from your app using e.g. osc or (a heavier option) twisted.

kivy_android_service.1604054117.txt.gz · Dernière modification : 2020/10/30 10:35 de serge