2013年6月2日 星期日

Android AlarmClock ACTION_SET_ALARM intent produces exception

The given example produces an Exception (android.content.ActivityNotFoundException: No Activity found to handle Intent)
Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); 
i.putExtra(AlarmClock.EXTRA_MESSAGE, "New Alarm"); 
i.putExtra(AlarmClock.EXTRA_HOUR, hours); 
i.putExtra(AlarmClock.EXTRA_MINUTES, mins); 
startActivity(i); 
on my SGS2 Android Version 2.3.3. Do you have any ideas, what can be going wrong? An another intent request (e.g. selecting a contact from the address book) works fine.
Thank you, Artjom
share|improve this question
Look at this question Android AlarmClock causing force close, I think its same as yours, and Also look at the answer, is it solved your problem? If that answer solved your problem then please let me know.. – user370305Dec 20 '11 at 9:17

2 Answers


Do you have any ideas, what can be going wrong?
The device does not support that activity. This is not unheard of. Either catch the exception and let the user know, or use PackageManager and queryIntentActivities() to see if anything will respond to your Intent in advance of calling startActivity().
share|improve this answer
Is this is a vendor specific behavior? The same activities can also work with some devices and do not with other? – Artjom Sep 5 '11 at 13:24

You need to set permission in manifest file also.
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
-------------------------------------------------------------------

It appears that there is no documented Intent for launching the alarm clock in the Android SDK. Having said that, here are a few resources you can try that should get you around that:
share|improve this answer

沒有留言:

張貼留言

Related Posts Plugin for WordPress, Blogger...