Root access is possible.
Basically I need a way to read content://settings/system/alarm_alert from an application and get the time (or time remaining) of the alarms.
I found the old project android-alarm-database, but that only works for the older alarm clock application.
The DeskClock application (that replaced the older AlarmClock application) sets alarms using the Alarm Manager. Unfortunately its not possible to read the existing alarms from the Alarm Manager, unless you know the PendingIntent that created it. DeskClock stores these PendingIntents, as well as other alarm information, in an internal database. However, there is another way to discover the time of the last alarm set or removed:
DeskClock sends out a broadcast intent called android.intent.action.ALARM_CHANGED when it updates the status bar icon (with an extra boolean alarmSet to indicate on/off) and updates Systems.Settings.NEXT_ALARM_FORMATTED which you can receive using the following broadcast receiver:
private static final String tag = "TestReceiver";
@Override
public void onReceive(Context context, Intent intent)
{
Log.d(tag, "intent=" + intent);
Boolean message = intent.getBooleanExtra("alarmSet",false);
Log.d(tag, "alarmSet: " + message);
Log.d(tag, "next alarm: " + Settings.System.getString(context.getContentResolver(),android.provider.Settings.System.NEXT_ALARM_FORMATTED));
}
and with the following intent filter in your AndroidManifest.xml:
<receiver android:name=".TestReceiver">
<intent-filter>
<action android:name="android.intent.action.ALARM_CHANGED"></action>
</intent-filter>
</receiver>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With