use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class GcmRefreshJob method notifyGcmFailure.
private void notifyGcmFailure() {
Intent intent = new Intent(context, PlayServicesProblemActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 1122, intent, PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setSmallIcon(R.drawable.icon_notification);
builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_action_warning_red));
builder.setContentTitle(context.getString(R.string.GcmRefreshJob_Permanent_Signal_communication_failure));
builder.setContentText(context.getString(R.string.GcmRefreshJob_Signal_was_unable_to_register_with_Google_Play_Services));
builder.setTicker(context.getString(R.string.GcmRefreshJob_Permanent_Signal_communication_failure));
builder.setVibrate(new long[] { 0, 1000 });
builder.setContentIntent(pendingIntent);
((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)).notify(12, builder.build());
}
use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class NotificationState method getDeleteIntent.
public PendingIntent getDeleteIntent(Context context) {
int index = 0;
long[] ids = new long[notifications.size()];
boolean[] mms = new boolean[ids.length];
for (NotificationItem notificationItem : notifications) {
ids[index] = notificationItem.getId();
mms[index++] = notificationItem.isMms();
}
Intent intent = new Intent(context, DeleteNotificationReceiver.class);
intent.setAction(DeleteNotificationReceiver.DELETE_NOTIFICATION_ACTION);
intent.putExtra(DeleteNotificationReceiver.EXTRA_IDS, ids);
intent.putExtra(DeleteNotificationReceiver.EXTRA_MMS, mms);
intent.setData((Uri.parse("custom://" + System.currentTimeMillis())));
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class NotificationState method getQuickReplyIntent.
public PendingIntent getQuickReplyIntent(Context context, Recipients recipients) {
if (threads.size() != 1)
throw new AssertionError("We only support replies to single thread notifications! " + threads.size());
Intent intent = new Intent(context, ConversationPopupActivity.class);
intent.putExtra(ConversationActivity.RECIPIENTS_EXTRA, recipients.getIds());
intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, (long) threads.toArray()[0]);
intent.setData((Uri.parse("custom://" + System.currentTimeMillis())));
return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class NotificationState method getAndroidAutoHeardIntent.
public PendingIntent getAndroidAutoHeardIntent(Context context, int notificationId) {
long[] threadArray = new long[threads.size()];
int index = 0;
for (long thread : threads) {
Log.w("NotificationState", "getAndroidAutoHeardIntent Added thread: " + thread);
threadArray[index++] = thread;
}
Intent intent = new Intent(AndroidAutoHeardReceiver.HEARD_ACTION);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
intent.setClass(context, AndroidAutoHeardReceiver.class);
intent.setData((Uri.parse("custom://" + System.currentTimeMillis())));
intent.putExtra(AndroidAutoHeardReceiver.THREAD_IDS_EXTRA, threadArray);
intent.putExtra(AndroidAutoHeardReceiver.NOTIFICATION_ID_EXTRA, notificationId);
intent.setPackage(context.getPackageName());
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
use of android.app.PendingIntent in project Signal-Android by WhisperSystems.
the class NotificationState method getMarkAsReadIntent.
public PendingIntent getMarkAsReadIntent(Context context, int notificationId) {
long[] threadArray = new long[threads.size()];
int index = 0;
for (long thread : threads) {
Log.w("NotificationState", "Added thread: " + thread);
threadArray[index++] = thread;
}
Intent intent = new Intent(MarkReadReceiver.CLEAR_ACTION);
intent.setClass(context, MarkReadReceiver.class);
intent.setData((Uri.parse("custom://" + System.currentTimeMillis())));
intent.putExtra(MarkReadReceiver.THREAD_IDS_EXTRA, threadArray);
intent.putExtra(MarkReadReceiver.NOTIFICATION_ID_EXTRA, notificationId);
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
Aggregations