Search in sources :

Example 81 with PendingIntent

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);
}
Also used : AlarmManager(android.app.AlarmManager) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 82 with 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);
}
Also used : Recipients(org.thoughtcrime.securesms.recipients.Recipients) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 83 with PendingIntent

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);
}
Also used : NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Example 84 with PendingIntent

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);
}
Also used : AlarmManager(android.app.AlarmManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Example 85 with 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;
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Aggregations

PendingIntent (android.app.PendingIntent)1208 Intent (android.content.Intent)1010 Notification (android.app.Notification)222 NotificationCompat (android.support.v4.app.NotificationCompat)167 AlarmManager (android.app.AlarmManager)149 NotificationManager (android.app.NotificationManager)148 Bundle (android.os.Bundle)75 RemoteViews (android.widget.RemoteViews)67 RemoteException (android.os.RemoteException)64 Resources (android.content.res.Resources)62 Bitmap (android.graphics.Bitmap)61 Context (android.content.Context)60 ComponentName (android.content.ComponentName)55 Test (org.junit.Test)44 Uri (android.net.Uri)42 IntentFilter (android.content.IntentFilter)41 SharedPreferences (android.content.SharedPreferences)36 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)33 UserHandle (android.os.UserHandle)31 ArrayList (java.util.ArrayList)30