use of android.support.v4.app.NotificationCompat.Builder in project Klyph by jonathangerbaud.
the class KlyphNotification method sendNotification.
public static void sendNotification(Context context, Builder builder) {
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
Intent resultIntent = new Intent(context, MainActivity.class);
resultIntent.putExtra(KlyphBundleExtras.SHOW_NOTIFICATION_MENU, true);
stackBuilder.addNextIntentWithParentStack(resultIntent);
int intentCode = (int) Math.round(Math.random() * 1000000);
// Gets a PendingIntent containing the entire back stack
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(intentCode, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(resultPendingIntent);
Intent intent = new Intent(context, NotificationGroupDeletedReceiver.class);
builder.setDeleteIntent(PendingIntent.getBroadcast(context.getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT));
final NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
final String tag = context.getPackageName() + "_grouped";
final int id = 0;
// pair (tag, id) must be unique
// tag is the unique key
mNotificationManager.notify(tag, id, builder.build());
}
use of android.support.v4.app.NotificationCompat.Builder in project Talon-for-Twitter by klinker24.
the class TrimDataService method notifyNewVersion.
public void notifyNewVersion(String version) {
Intent goToStore = new Intent(this, RedirectToPlayStore.class);
PendingIntent storePending = PendingIntent.getActivity(this, 0, goToStore, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setContentTitle("Talon Version " + version);
builder.setContentText("Click to update.");
builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
builder.setSmallIcon(R.drawable.ic_stat_icon);
builder.setContentIntent(storePending);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(552, builder.build());
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class AuthenticationErrorNotifications method showAuthenticationErrorNotification.
public void showAuthenticationErrorNotification(Account account, boolean incoming) {
int notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, incoming);
Context context = controller.getContext();
PendingIntent editServerSettingsPendingIntent = createContentIntent(context, account, incoming);
String title = context.getString(R.string.notification_authentication_error_title);
String text = context.getString(R.string.notification_authentication_error_text, account.getDescription());
NotificationCompat.Builder builder = controller.createNotificationBuilder().setSmallIcon(R.drawable.notification_icon_warning).setWhen(System.currentTimeMillis()).setAutoCancel(true).setTicker(title).setContentTitle(title).setContentText(text).setContentIntent(editServerSettingsPendingIntent).setStyle(new BigTextStyle().bigText(text)).setVisibility(NotificationCompat.VISIBILITY_PUBLIC).setCategory(NotificationCompat.CATEGORY_ERROR);
controller.configureNotification(builder, null, null, NOTIFICATION_LED_FAILURE_COLOR, NOTIFICATION_LED_BLINK_FAST, true);
getNotificationManager().notify(notificationId, builder.build());
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class CertificateErrorNotifications method showCertificateErrorNotification.
public void showCertificateErrorNotification(Account account, boolean incoming) {
int notificationId = NotificationIds.getCertificateErrorNotificationId(account, incoming);
Context context = controller.getContext();
PendingIntent editServerSettingsPendingIntent = createContentIntent(context, account, incoming);
String title = context.getString(R.string.notification_certificate_error_title, account.getDescription());
String text = context.getString(R.string.notification_certificate_error_text);
NotificationCompat.Builder builder = controller.createNotificationBuilder().setSmallIcon(getCertificateErrorNotificationIcon()).setWhen(System.currentTimeMillis()).setAutoCancel(true).setTicker(title).setContentTitle(title).setContentText(text).setContentIntent(editServerSettingsPendingIntent).setVisibility(NotificationCompat.VISIBILITY_PUBLIC).setCategory(NotificationCompat.CATEGORY_ERROR);
controller.configureNotification(builder, null, null, NOTIFICATION_LED_FAILURE_COLOR, NOTIFICATION_LED_BLINK_FAST, true);
getNotificationManager().notify(notificationId, builder.build());
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class DeviceNotifications method buildSummaryNotification.
public Notification buildSummaryNotification(Account account, NotificationData notificationData, boolean silent) {
int unreadMessageCount = notificationData.getUnreadMessageCount();
NotificationCompat.Builder builder;
if (isPrivacyModeActive() || !platformSupportsExtendedNotifications()) {
builder = createSimpleSummaryNotification(account, unreadMessageCount);
} else if (notificationData.isSingleMessageNotification()) {
NotificationHolder holder = notificationData.getHolderForLatestNotification();
builder = createBigTextStyleSummaryNotification(account, holder);
} else {
builder = createInboxStyleSummaryNotification(account, notificationData, unreadMessageCount);
}
if (notificationData.containsStarredMessages()) {
builder.setPriority(NotificationCompat.PRIORITY_HIGH);
}
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
PendingIntent deletePendingIntent = actionCreator.createDismissAllMessagesPendingIntent(account, notificationId);
builder.setDeleteIntent(deletePendingIntent);
lockScreenNotification.configureLockScreenNotification(builder, notificationData);
boolean ringAndVibrate = false;
if (!silent && !account.isRingNotified()) {
account.setRingNotified(true);
ringAndVibrate = true;
}
NotificationSetting notificationSetting = account.getNotificationSetting();
controller.configureNotification(builder, (notificationSetting.shouldRing()) ? notificationSetting.getRingtone() : null, (notificationSetting.shouldVibrate()) ? notificationSetting.getVibration() : null, (notificationSetting.isLed()) ? notificationSetting.getLedColor() : null, NOTIFICATION_LED_BLINK_SLOW, ringAndVibrate);
return builder.build();
}
Aggregations