Java Code Examples for android.support.v4.app.NotificationCompat#PRIORITY_HIGH
The following examples show how to use
android.support.v4.app.NotificationCompat#PRIORITY_HIGH .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UrlManager.java From delion with Apache License 2.0 | 5 votes |
private void createOptInNotification(boolean highPriority) { PendingIntent pendingIntent = createOptInIntent(); int priority = highPriority ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_MIN; // Get values to display. Resources resources = mContext.getResources(); String title = resources.getString(R.string.physical_web_optin_notification_title); String text = resources.getString(R.string.physical_web_optin_notification_text); Bitmap largeIcon = BitmapFactory.decodeResource(resources, R.mipmap.app_icon); // Create the notification. Notification notification = new NotificationCompat.Builder(mContext) .setLargeIcon(largeIcon) .setSmallIcon(R.drawable.ic_physical_web_notification) .setContentTitle(title) .setContentText(text) .setContentIntent(pendingIntent) .setPriority(priority) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setAutoCancel(true) .setLocalOnly(true) .build(); mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_PHYSICAL_WEB, notification); }
Example 2
Source File: UrlManager.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void createOptInNotification(boolean highPriority) { PendingIntent pendingIntent = createOptInIntent(); int priority = highPriority ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_MIN; // Get values to display. Resources resources = mContext.getResources(); String title = resources.getString(R.string.physical_web_optin_notification_title); String text = resources.getString(R.string.physical_web_optin_notification_text); Bitmap largeIcon = BitmapFactory.decodeResource(resources, R.mipmap.app_icon); // Create the notification. Notification notification = new NotificationCompat.Builder(mContext) .setLargeIcon(largeIcon) .setSmallIcon(R.drawable.ic_physical_web_notification) .setContentTitle(title) .setContentText(text) .setContentIntent(pendingIntent) .setPriority(priority) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setAutoCancel(true) .setLocalOnly(true) .build(); mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_PHYSICAL_WEB, notification); }
Example 3
Source File: NotificationHelper.java From android with Apache License 2.0 | 4 votes |
public void showPrayerNotification(int prayer, long time, String location) { if (!mNotificationPrefs.isPrayerEnabled(prayer)) return; int defaults = NotificationCompat.DEFAULT_LIGHTS; String prayerName = mPrayerNames[prayer]; String notification = getPrayerText(prayer); Uri toneUri = null; int priority = NotificationCompat.PRIORITY_DEFAULT; if (mNotificationPrefs.isHeadsUpEnabled()) { priority = NotificationCompat.PRIORITY_HIGH; } if (mNotificationPrefs.hasNotificationTone(prayer)) { toneUri = Uri.parse(mNotificationPrefs.getNotificationTone(prayer)); } if (mNotificationPrefs.isNotificationEnabled(prayer)) { NotificationCompat.Builder builder = getNotificationTemplate(); builder.setTicker(notification) .setDefaults(defaults) .setWhen(time) .setContentTitle(prayerName) .setContentText(notification) .setPriority(priority) .setStyle(new NotificationCompat.BigTextStyle() .bigText(notification) .setSummaryText(location) ); if (mNotificationPrefs.isVibrationEnabled(prayer)) { builder.setVibrate(PATTERN_VIBRATE); } if (toneUri != null) { builder.setSound(toneUri); } mNotifier.notify("prayer", prayer, builder.build()); } else { if (mNotificationPrefs.isVibrationEnabled(prayer)) { playVibration(); } if (toneUri != null) { playRingtone(toneUri); } } cancel("reminder", prayer); }
Example 4
Source File: NotificationOptions.java From android-play-games-in-motion with Apache License 2.0 | 4 votes |
public void setPriorityAsHigh() { mNotificationPriority = NotificationCompat.PRIORITY_HIGH; }