-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Alarms #8
Comments
I'd love that, really. |
@jtoledo1974 I will be taking this up. |
That's great! Just a heads up: I tried to make it work myself, but IMHO Python for Android is not handling long values correctly so I couldn't get it to work. See kivy/python-for-android#229 |
@jtoledo1974 I remember reading your update that you were able to get this working. Were you able to get the alarms working as well? |
It is possible to set up alarms, you just have to come up with your own long integer to pass and not rely on System.currentTimeMillis(). For my own app I worked around it by using the AlarmManager.ELAPSED_REALTIME_WAKEUP rather than RTC_WAKEUP, since for that I can use SystemClock.elapsedRealtime() which doesn't create a problem unless the phone has been up for more than 22 days. That was good enough for me, and I didn't feel like having to mess with timezones to come up with the proper long RTC value to pass to the alarm manager. My working code is at https://github.com/jtoledo1974/Planilla/blob/master/service/main.py#L150 . I'm very sorry that I didn't use English for variable names and comments. Hope you can follow along. Basically every alarma['hora'] is a datetime object at which I want to set up an alarm. The python-for-android bug of not being able to deal with returned long integers larger than maxint still stands. |
Thanks @jtoledo1974! I will try to build on it. |
There has been a chat about a schedule facade, it is not evident how it should really work across platforms or if it fits in plyer. |
An API for setting an alarm and triggering an event sometime in the future.
Android: AlarmManager
Linux: cron
OSX: cron
Windows: Task Scheduler
The text was updated successfully, but these errors were encountered: