Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve provider for content://com.android.alarmclock/alarm

I am making this app just for me, with api 9 and stock alarm clock.

I found this: http://code.google.com/p/android-alarm-database/

and in on create of my main activity is this:

ContentResolver cr = getContentResolver();
AlarmDatabase ad = new AlarmDatabase(cr);
Record r = ad.getNearestEnabledAlarm();

When i use URI content://com.android.alarmclock/alarm it gives me in logcat:

Cannot resolve provider for content://com.android.alarmclock/alarm
Failed to find provider info for com.android.alarmclock

And than i tried with content://com.android.deskclock/alarm:

Permission denied: checkComponentPermission() reqUid=10009
Permission Denial: opening provider com.android.deskclock.AlarmProvider from ProcessRecord{407cf3b0 15716:com.my.app/10137} (pid=15716, uid=10137) requires null or null
like image 846
Tomi S Avatar asked Mar 27 '26 21:03

Tomi S


2 Answers

Note that the Permissions of a alarms.db file in /data/data/com.android.alarmclock/databases/alarms.db (API 7-8) or /data/data/com.android.deskclock/databases/alarms.db (API 9-15) is -rw-rw----.

By this thing we cannot access the db file, even with an idea of URIMatcher class.

Till API 8, we have no specialized class available for Alarms, but from API 9, we can set an Intent with loaded Extras to set an Alarm at approximate Time.

I am also searching for ways to get down to solve this problem, hope someone finds the complete solution to this mess.

like image 172
Sri Krishna Avatar answered Mar 31 '26 16:03

Sri Krishna


Correct URI starting from API 9 is "content://com.android.deskclock/alarm". I'm still resolving the permission problem however.

like image 24
isemench Avatar answered Mar 31 '26 14:03

isemench