use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class MessageNotifier method clearReminder.
public static void clearReminder(Context context) {
Intent alarmIntent = new Intent(ReminderReceiver.REMINDER_ACTION);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(pendingIntent);
}
use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class NotificationItem method getPendingIntent.
public PendingIntent getPendingIntent(Context context) {
Intent intent = new Intent(context, ConversationActivity.class);
Recipients notifyRecipients = threadRecipients != null ? threadRecipients : recipients;
if (notifyRecipients != null)
intent.putExtra("recipients", notifyRecipients.getIds());
intent.putExtra("thread_id", threadId);
intent.setData((Uri.parse("custom://" + System.currentTimeMillis())));
return TaskStackBuilder.create(context).addNextIntentWithParentStack(intent).getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
}
use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class UpdateApkReadyListener method displayInstallNotification.
private void displayInstallNotification(Context context, Uri uri) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(uri, "application/vnd.android.package-archive");
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
Notification notification = new NotificationCompat.Builder(context).setOngoing(true).setContentTitle(context.getString(R.string.UpdateApkReadyListener_Signal_update)).setContentText(context.getString(R.string.UpdateApkReadyListener_a_new_version_of_signal_is_available_tap_to_update)).setSmallIcon(R.drawable.icon_notification).setColor(context.getResources().getColor(R.color.textsecure_primary)).setPriority(NotificationCompat.PRIORITY_HIGH).setCategory(NotificationCompat.CATEGORY_REMINDER).setContentIntent(pendingIntent).build();
ServiceUtil.getNotificationManager(context).notify(666, notification);
}
use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class PersistentAlarmManagerListener method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
long scheduledTime = getNextScheduledExecutionTime(context);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent alarmIntent = new Intent(context, getClass());
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, 0);
if (System.currentTimeMillis() >= scheduledTime) {
scheduledTime = onAlarm(context, scheduledTime);
}
Log.w(TAG, getClass() + " scheduling for: " + scheduledTime);
alarmManager.cancel(pendingIntent);
alarmManager.set(AlarmManager.RTC_WAKEUP, scheduledTime, pendingIntent);
}
use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class KeyCachingService method buildLaunchIntent.
private PendingIntent buildLaunchIntent() {
Intent intent = new Intent(this, ConversationListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent launchIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
return launchIntent;
}
Aggregations