Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detect default alarm clock application alarms

I would like to know if there is a way (probably a system broadcast) to know that the alarm clock default application is now start ringing.

if not - I'll be satisfied also if I could get progrematically list of all active alarms been set by the user(which I could extract from each alarm the exact time it would ring..)

what I tried so far:

I know there is a way to get formatted string to next alarm:

  String nextAlarm = Settings.System.getString(context.getContentResolver(), Settings.System.NEXT_ALARM_FORMATTED);

this method returns for certain devices (such all Samsung Galaxy Series..) an empty string, even if the alarm was set (by Samsung native alarm clock app..) . I bet it works only on nexus devices with the default alarms app.

I would like to get a generic solution that would work either way.

TIA

UPDATE

I will try to make my question clearer:

I'm not interested (directly) to know all PendingIntent been held by the AlarmManager

I'm interested only to know about alarms set implicitly by the user, especially about the ones he activated for waking up.

my final goal is to get hint that the user waking up. that's it..

like image 875
Tal Kanel Avatar asked Feb 04 '14 12:02

Tal Kanel


People also ask

What is alarms and Clock app in Windows 10?

Windows Clock (known as Clock & Alarms on Pocket PC 2000, Alarms on Windows 8.1, and, until July 2022, Alarms & Clock on Windows 10) is a time management app for Microsoft Windows, with five key features: alarms, world clocks, timers, a stopwatch, and focus sessions.

Where is my alarm application?

A standard alarm on an Android device is usually found in the Clock application. Open the App Drawer by swiping up on your phone, then select the Clock icon. Make sure Alarm is selected on the bottom left, then select the plus (+) sign. Pick the time you want your alarm to go off, then select OK.

Can I uninstall Microsoft alarms and Clock?

Type get-appxpackage *Microsoft. WindowsAlarms* | remove-appxpackage on the PowerShell and hit Enter. This will uninstall the Alarm and Clock app.


1 Answers

Hi looks like I am little late to the party but anyways here is what i could dig.

1.) A system broadcast to know that the alarm clock default application is now start ringing.

I checked ADB logs from my Note3 , i could see this log whenever default alarm rings "I/SecExternalDisplayIntents_Java(2797): Intent Recieved .. - com.samsung.sec.android.clockpackage.alarm.ALARM_STARTED_IN_ALERT BroadCast Map value - 7"

I tried catching the intent with action name "com.samsung.sec.android.clockpackage.alarm.ALARM_STARTED_IN_ALERT" successfully. Though I highly doubt if this intent be avialable across all android devices.

The package name of intent action gave me further hints and i found the answer to

2.)I'll be satisfied also if I could get progrematically list of all active alarms been set by the user

seems the clockpackage exposes a Content provider at "com.samsung.sec.android.clockpackage/alarm" location i could query all the alarms set by user from this DB( enabled /disabled/name/snooze details etc ).

By toggling the enable/disable button i figured the value for a the alarm been on/off is in column no 1(columns start from 0 index). Incase you want more data i would suggest pulling the DB and viewing the table structure in SQlite DB browser (device may have to be rooted to pull the entire DB).

Similar DB must exist on other android devices as well (I broke my nexus else could have tested on that as well ) cheers

like image 95
amIT Avatar answered Oct 09 '22 20:10

amIT