Kivy--Plyer--Android--sending notification while app is not running Kivy--Plyer--Android--sending notification while app is not running android android

Kivy--Plyer--Android--sending notification while app is not running


I think you should take a look at the Android AlarmManager. If this is what you need, here is an example for Kivy.

AlarmManager

This class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running.


On Android, I'm not sure how I would implement it without a background service.

The thing with background services is they also get killed when the application that started the process gets killed.I know 2-3 ways to prevent that on Android, I consider it hack, but maybe it's a feature.

  1. One is to use the START_STICKY flag. It's implemented in python-for-android, but it seems broken to me.

  2. Another one is to use the a recent feature, setAutoRestartService(). It will make the service restart itself gracefully/programmatically on kill.

  3. Bonus way use a BroadcastReceiver, but this is not implemented in p4a.