25 lines
854 B
Java
25 lines
854 B
Java
package ru.vfilippov.electronreminder;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
|
|
/**
|
|
* This BroadcastReceiver automatically (re)starts the alarm when the device is
|
|
* rebooted. This receiver is set to be disabled (android:enabled="false") in the
|
|
* application's manifest file. When the user sets the alarm, the receiver is enabled.
|
|
* When the user cancels the alarm, the receiver is disabled, so that rebooting the
|
|
* device will not trigger this receiver.
|
|
*/
|
|
public class RecheckBootReceiver extends BroadcastReceiver
|
|
{
|
|
RecheckAlarmReceiver alarm = new RecheckAlarmReceiver();
|
|
|
|
@Override
|
|
public void onReceive(Context context, Intent intent)
|
|
{
|
|
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED"))
|
|
alarm.setAlarm(context);
|
|
}
|
|
}
|