Android Open Source - TodoList Boot Receiver






From Project

Back to project page TodoList.

License

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.

Java Source Code

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);
  }
}




Java Source Code List

lyc.app.AddActivity.java
lyc.app.App.java
lyc.app.BootReceiver.java
lyc.app.DateUtils.java
lyc.app.MainActivity.java
lyc.app.TodoService.java
lyc.app.adapter.TodoCursorAdapter.java
lyc.app.fragment.FinishedTodoFragment.java
lyc.app.fragment.UnFinishedTodoFragment.java
lyc.app.provider.TodoProvider.java
lyc.simplesqlite.annotation.Column.java
lyc.simplesqlite.annotation.Table.java
lyc.simplesqlite.exception.AnnotationNotFoundException.java
lyc.simplesqlite.util.MetaData.java
lyc.simplesqlite.util.StringUtils.java