Hi,
I have a broadcast receiver to handle BOOT_COMPLETED intent. In that
if we keep AlarmManager.set method is not working.
AlarmBootReceiver:
public void onReceive(Context context, Intent intent) {
Log.d("AlarmBootReceiver", " boot receiver 1 ");
AlarmManager mgr=(AlarmManager)context.getSystemService
(Context.ALARM_SERVICE);
Intent i=new Intent(context, OnAlarmReceiver.class);
PendingIntent pi=PendingIntent.getBroadcast(context, 0, i, 0);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 30);
SimpleDateFormat sdf = new SimpleDateFormat();
sdf.applyPattern("k:m:s");
Log.d("AlarmRingerBootReceiver", " second " + sdf.format
(calendar.getTimeInMillis()));
mgr.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
pi);
}
AlarmReceiver: (it never gets triggered)
public void onReceive(Context context, Intent intent) {
Log.d("AlarmReceiver", "it is not working ...");
}
Manifest file:
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:label="@string/app_name">
<receiver android:name=".OnBootReceiver">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>
<receiver android:name=".OnAlarmReceiver"
android:exported="true">
</receiver>
</application>
Tried all combinations of android:exported="true" and other
attributes.
Please help.....
Thanks,
RJ
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---