List of usage examples for android.app PendingIntent FLAG_UPDATE_CURRENT
int FLAG_UPDATE_CURRENT
To view the source code for android.app PendingIntent FLAG_UPDATE_CURRENT.
Click Source Link
From source file:Main.java
private static PendingIntent genPendingBroadcast(Context context, int requestCode, Intent broadcastIntent) { PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, broadcastIntent, PendingIntent.FLAG_UPDATE_CURRENT); return pendingIntent; }
From source file:Main.java
public static void cancel(Context context, Intent intent) { PendingIntent p = PendingIntent.getBroadcast(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarm.cancel(p);/*from w ww. ja v a2s .c o m*/ Log.d("petsitter-alarm", "Alarme cancelado."); }
From source file:Main.java
public static void setClickPendingIntent(RemoteViews remoteButton, Intent intent, Context context, int buttonId) { PendingIntent clickPI = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); remoteButton.setOnClickPendingIntent(buttonId, clickPI); }
From source file:Main.java
static PendingIntent createOpenCalendarEventPendingIntent(Context context) { Intent intent = createCalendarIntent(Intent.ACTION_VIEW); return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); }
From source file:Main.java
public static void cancelAlarm(Context context, int alarmId, Intent intent) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent pi = PendingIntent.getBroadcast(context, alarmId, intent, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.cancel(pi);/*from w w w. jav a 2 s . c o m*/ }
From source file:Main.java
public static void scheduleRepeat(Context context, Intent intent, Long triggerAtMillis, Long intervalMillis) { PendingIntent p = PendingIntent.getBroadcast(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, triggerAtMillis, intervalMillis, p); Log.d("petsitter-alarm", "Alarme agendado com sucesso com repeat."); }
From source file:Main.java
public static PendingIntent createNewEventPendingIntent(Context context) { Intent intent = createNewEventIntent(); return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); }
From source file:Main.java
public static void cancelAlarm(Context context, Intent intent, int notificationId) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.cancel(pendingIntent);//from www .j a v a2 s .com }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.CUPCAKE) public static void startAlarmService(Context context, int triggerAtMillis, Class<?> cls, String action) { Intent intent = new Intent(context, cls); intent.setAction(action);//from w w w . j a v a 2 s . c o m PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); startAlarmIntent(context, triggerAtMillis, pendingIntent); }
From source file:Main.java
public static void closeService(Context context, Class<?> cls, String action) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, cls); intent.setAction(action);/*from w w w . j a v a2 s. c o m*/ PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.cancel(pendingIntent); }