Android Open Source - LearnByHeart Reminder Util






From Project

Back to project page LearnByHeart.

License

The source code is released under:

Apache License

If you think the Android project LearnByHeart 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 com.mps.learn.pb.alarm;
//  w  w w.ja v a  2 s .c o m
import com.mps.learn.pb.App;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Intent;

public final class ReminderUtil {

  private ReminderUtil(){
    //NO 
  }
  
  public static void setOneTimeAlarm(AlarmManager alarmManager) {
    Intent intent = new Intent(App.INSTANCE, ReminderUtil.class);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(App.INSTANCE, 0, intent, PendingIntent.FLAG_ONE_SHOT);
    alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (5 * 1000), pendingIntent);
    
    // Hopefully your alarm will have a lower frequency than this!
    alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
            AlarmManager.INTERVAL_FIFTEEN_MINUTES,
            AlarmManager.INTERVAL_FIFTEEN_MINUTES, pendingIntent);
    
  }

  public static void setRepeatingAlarm(AlarmManager alarmManager) {
    Intent intent = new Intent(App.INSTANCE, ReminderUtil.class);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(App.INSTANCE, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
    alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), (5 * 1000), pendingIntent);
  }

}




Java Source Code List

com.mps.learn.pb.App.java
com.mps.learn.pb.PhraseManager.java
com.mps.learn.pb.adapter.AllPhraseAdapter.java
com.mps.learn.pb.alarm.ReminderReceiver.java
com.mps.learn.pb.alarm.ReminderUtil.java
com.mps.learn.pb.db.DataSourcePhrase.java
com.mps.learn.pb.db.DatabaseHelper.java
com.mps.learn.pb.db.PhraseReaderContract.java
com.mps.learn.pb.gcm.GcmBroadcastReceiver.java
com.mps.learn.pb.gcm.GcmIntentService.java
com.mps.learn.pb.http.DataUpdaterCallback.java
com.mps.learn.pb.http.DataUpdaterTask.java
com.mps.learn.pb.http.HttpConstant.java
com.mps.learn.pb.http.PhraseParser.java
com.mps.learn.pb.model.PhraseBook.java
com.mps.learn.pb.model.PhraseModel.java
com.mps.learn.pb.ui.activities.AddPhraseActivity.java
com.mps.learn.pb.ui.activities.MainActivity.java
com.mps.learn.pb.ui.activities.PhraseViewActivity.java
com.mps.learn.pb.ui.activities.SettingActivity.java
com.mps.learn.pb.ui.factivities.BaseActivity.java
com.mps.learn.pb.ui.factivities.FActivity.java
com.mps.learn.pb.ui.factivities.FoldableListActivity.java
com.mps.learn.pb.ui.factivities.ItemsAdapter.java
com.mps.learn.pb.ui.factivities.PaintingsAdapter.java
com.mps.learn.pb.ui.factivities.SpannableBuilder.java
com.mps.learn.pb.ui.factivities.UnfoldableDetailsActivity.java
com.mps.learn.pb.ui.views.FoldableItemLayout.java
com.mps.learn.pb.ui.views.FoldableListLayout.java
com.mps.learn.pb.ui.views.UnfoldableView.java
com.mps.learn.pb.ui.views.shading.FoldShading.java
com.mps.learn.pb.ui.views.shading.GlanceFoldShading.java
com.mps.learn.pb.ui.views.shading.SimpleFoldShading.java
com.mps.learn.pb.util.CommonConstants.java
com.mps.learn.pb.util.Debugger.java