I want to run a repeating alarm, starting at system boot. This is the code:
// Run the SendService once an hour
@Override
public void onReceive(Context context, Intent intent) {
//Logger.getInstance().writeLine(getClass().getName(), "Received boot, start SMS repeating alarm");
Toast.makeText(context, "Starting SMS2Mail alarm on boot", Toast.LENGTH_LONG).show();
Intent svcIntent = new Intent(context, MessageFileService.class);
svcIntent.setAction(MessageFileService.GET_INTENT);
sendSMSIntent = PendingIntent.getBroadcast(context, 0, svcIntent, 0);
alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
AlarmManager.INTERVAL_FIFTEEN_MINUTES,
AlarmManager.INTERVAL_HOUR, sendSMSIntent);
}
The manifest has
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
and
<service
android:name="com.cio1.sms2mail.StartSendService"
android:enabled="true"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</service>
The AlarmManager does not fire at all, as far as any of my debugging resources can tell me. Also, any clues as to how to recover the LogCat information from boot time would help. Also, does this have to do with the restriction on broadcast receivers mentioned here? Thanks.