Android Alarm Create setAlarm(Context context, PendingIntent pIntent)

Here you can find the source of setAlarm(Context context, PendingIntent pIntent)

Description

set Alarm

License

Apache License

Declaration

private static void setAlarm(Context context, PendingIntent pIntent) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import android.app.AlarmManager;
import android.app.PendingIntent;

import android.content.Context;

public class Main {
    private static void setAlarm(Context context, PendingIntent pIntent) {
        AlarmManager alarmManager = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
            alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
                    5000, 5000, pIntent);
        } else {/*ww  w .j  a  va  2s  .com*/
            alarmManager.set(AlarmManager.ELAPSED_REALTIME, 5000, pIntent);
        }
    }
}

Related

  1. addReminderAlarm(Context context, Date date, String group, boolean toast)
  2. setAlarm( Class receiver, Calendar calendar, String action, Object... parameters)
  3. setAlarm(Context context, Calendar calendar, PendingIntent pIntent)
  4. setAlarm(Context context, Calendar calendar, PendingIntent pIntent)
  5. setAlarm(Context context, Calendar calendar, PendingIntent pIntent)
  6. setAlarm(Context context, Calendar calendar, PendingIntent pIntent)