Android Open Source - MyLibReminder Loan Alarm Receiver

From Project

Back to project page MyLibReminder.


The source code is released under:

Apache License

If you think the Android project MyLibReminder 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.geonnave.mylibreminder;
/*w  ww .  j a  va  2 s  .com*/
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class LoanAlarmReceiver extends BroadcastReceiver {

    private static final int NOTIFICATION = 3456; 
    private NotificationManager mNM;
    /*since you're always doing a 1-time notification, we can make this final and static, the number
     won't change. If you want it to change, consider using SharedPreferences or similar to keep track 
     of the number. You would have the same issue with a Service since you call stopself() and so,
     you would delete the object every time.*/

      public void onReceive(Context context,Intent intent) {

        final NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
//        builder.setSmallIcon(R.drawable.clock_alarm);
        builder.setContentTitle("Time is up");
        builder.setVibrate(new long[] { 0, 200, 100, 200 });
        final Notification notification =; 

        mNM.notify(NOTIFICATION, notification);


Java Source Code List