Displaying the next alarm is a very common thing for Android apps, and you can often find widgets, lock screen replacements, and clock apps that do this with no problem. That’s because it’s not that hard to get the next alarm time from the system, assuming that you’re an app.
If you’re not an app, it’s slightly harder. Scratch that: it’s a nightmare. Tasker users have been using an awkward work around for this issue for years, involving running sqlite3 code via a Tasker plugin. That plugin is no longer being updated, and doesn’t work on a lot of newer devices. I spent ages trying to find a work around, eventually giving up and doing something different. Instead of being able to trigger a task before the alarm goes off automatically, I had to set when that was going to be as well as the alarm. Not ideal.
Luckily, the solution to the problem is now available in Google Play. João Dias, known for apps like AutoRemote and AutoShortcut, now has an app available called AutoAlarm, which fixes this problem. Once installed, you’ll have a new action and a new context in Tasker. The action simply sends off a message to the system, asking for the next alarm. The reply triggers the context (meaning you need to set up a profile using it), and you then have a ton of local variables to choose from that give you the next alarm in different forms, such as %minutes, %year, %hour, and so on (listed in the Google Play description).
This plug-in is now a vital part of my sleep mode. At 5:50 every morning, a profile triggers that runs the AutoAlarm action. The reply from the system triggers a second profile, which initiates what I call “sunrise mode.” Starting 25 minutes before the alarm, it gradually raises the light in the room by about 20% every 5 minutes, simulating a sunrise. Before the plug-in was available, I had to set sunrise mode manually, because the old method for getting the alarm time doesn’t work on my device.
It’s a very simple plug-in, but it’s also invaluable if you need to know when the next alarm is.
Download: Google Play
Edit: How-to video