Open ghost opened 2 years ago
What you're showing is the next alarm in the full screen clock, not the widget. I don't think there is room in the widget. Showing the next alarm time on the full screen clock instead of the date information is possible in principle, but complicated by the fact that there doesn't seem to be a Unicode symbol for the image of an alarm clock that you've shown, so I would have to construct a view with an image and the time, or write out "Next Alarm DDD HH:MM:SS". Also the app has to either listen for broadcasts of ACTION_NEXT_ALARM_CLOCK_CHANGED or call getNextAlarmClock() frequently, in order to update when the next alarm is changed. Another issue is that the next alarm may be more than a week in the future, in which case showing the day of the week and the time won't do.
I'll think about it, but I'm working on something else at the moment. If you really wanted a widget, there are a few widgets on the Google Play Store which display the next alarm time, but they aren't open source, and I can't tell from the descriptions whether they listen for broadcasts of ACTION_NEXT_ALARM_CLOCK_CHANGED. I couldn't find an open source one.
Another potential issue is that getNextAlarmClock() only shows alarm clock alarms. Several apps, including one of mine, generate their own alarms so as to be able to use custom sounds or generate alarms based on your calendar or other data in your phone.
setAlarmClock(...)
is similar in function to setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, ...)
and there is no guarantee, either of which one your installed alarm clock app uses, or of which one any other installed app uses to schedule itself to be woken up and possibly do something other than sounding an alarm. So I don't think that it is possible to reliably identify the next alarm which will make a noise, which is presumably what you want.
First of all, thanks so much for this project! It's exactly what I was looking for and I greatly appreciate it being FOSS and on F-Droid :)
Would it be possible to add an option to show the time of the next alarm in the widget? I don't have any experience with Android development, but this appears to be how to get that info from the OS:
https://developer.android.com/reference/android/app/AlarmManager.html#getNextAlarmClock()
I've attached a simple mock showing what I mean, in case it's unclear. Thanks for considering this request!