Back to project page TodoList.
The source code is released under:
Apache License
If you think the Android project TodoList listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package lyc.app; //from w ww . j a v a2 s . c om import android.app.AlarmManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.Toast; /** * Created by ivan on 14-10-23. */ public class BootReceiver extends BroadcastReceiver { private static final String TAG = "BootReceiver"; @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "boot receiver --------"); Toast.makeText(context, "boot completed", Toast.LENGTH_SHORT).show(); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); int alarmType = AlarmManager.ELAPSED_REALTIME_WAKEUP; long timeOrLengthOfWait = 5000; Intent intentToFire = new Intent(context, TodoService.class); PendingIntent alarmIntent = PendingIntent.getService(context, 0, intentToFire, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.setInexactRepeating(alarmType, timeOrLengthOfWait, AlarmManager.INTERVAL_HALF_HOUR, alarmIntent); } }