Skip to content
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

Closed
brousch opened this issue Feb 12, 2014 · 7 comments
Closed

Feature Request: Alarms #8

brousch opened this issue Feb 12, 2014 · 7 comments

Comments

@brousch
Copy link
Contributor

brousch commented Feb 12, 2014

An API for setting an alarm and triggering an event sometime in the future.

Android: AlarmManager
Linux: cron
OSX: cron
Windows: Task Scheduler

@jtoledo1974
Copy link

I'd love that, really.

@trivedigaurav
Copy link
Member

@jtoledo1974 I will be taking this up.

@jtoledo1974
Copy link

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
I could see that the alarm had been registered with adb shell dumpsys alarm, but the callback was never called.

@trivedigaurav
Copy link
Member

@jtoledo1974 I remember reading your update that you were able to get this working. Were you able to get the alarms working as well?

@jtoledo1974
Copy link

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.

@trivedigaurav
Copy link
Member

Thanks @jtoledo1974! I will try to build on it.

@dessant
Copy link
Contributor

dessant commented May 5, 2015

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.
https://botbot.me/freenode/kivy-dev/2015-05-05/?msg=38384258&page=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants