detect default alarm clock application alarms

后端 未结 5 2195
深忆病人
深忆病人 2021-02-20 18:34

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 a

5条回答
  •  旧巷少年郎
    2021-02-20 19:04

    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

提交回复
热议问题