List of usage examples for android.app Notification PRIORITY_MAX
int PRIORITY_MAX
To view the source code for android.app Notification PRIORITY_MAX.
Click Source Link
From source file:fr.paug.droidcon.ui.debug.actions.ShowSessionNotificationDebugAction.java
@Override public void run(Context context, Callback callback) { Intent i = new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri("__keynote__")); PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); //= PendingIntent.getActivity(context, 0, mapIntent, 0); NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) .setContentTitle("test notification").setContentText("yep, this is a test") .setTicker("hey, you got a test") .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE) .setSmallIcon(R.drawable.ic_stat_notification).setContentIntent(pi) .setPriority(Notification.PRIORITY_MAX).setAutoCancel(true); NotificationCompat.InboxStyle richNotification = new NotificationCompat.InboxStyle(notifBuilder) .setBigContentTitle(/*from ww w . j ava 2 s .c o m*/ context.getResources().getQuantityString(R.plurals.session_notification_title, 1, 8, 1)); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(32534, richNotification.build()); }
From source file:com.redirectapps.tvkill.RepetitiveModeService.java
@Override protected void onHandleIntent(Intent intent) { //Set the running-boolean in MainActivity to true MainActivity.repetitiveModeRunning = true; //Display a Notification while this Service is running //Build the Notification NotificationBuilder = new NotificationCompat.Builder(this); NotificationBuilder.setOngoing(true); NotificationBuilder.setAutoCancel(false); NotificationBuilder.setPriority(Notification.PRIORITY_MAX); //NotificationBuilder.setCategory(Notification.CATEGORY_SERVICE); NotificationBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); NotificationBuilder.setSmallIcon(R.drawable.ic_power_settings_new_white_48dp); NotificationBuilder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)); NotificationBuilder.setContentTitle(getString(R.string.mode_running)); //Create a BroadcastReceiver that stops the service when called stopReceiver = new BroadcastReceiver() { @Override/*w w w. j a v a 2s . c o m*/ public void onReceive(Context context, Intent intent) { stopSelf(); } }; registerReceiver(stopReceiver, new IntentFilter("stop")); //Add a Action to the Notification that calls the BroadcastReceiver Intent receiverIntent = new Intent("stop"); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationBuilder.addAction(R.drawable.ic_clear_black_48dp, getString(R.string.stop), pendingIntent); //Display the notification mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotificationManager.notify(NotificationID, NotificationBuilder.build()); //Notify the user that the service has started Toast.makeText(getApplicationContext(), R.string.toast_mode_started, Toast.LENGTH_LONG).show(); //Send Patterns until this service is stopped if (selectedBrand == 0) while (run) { //Send Patterns for all Brands Brand.killAll(this); } else { BrandContainer.getAllBrands(); Brand b = BrandContainer.getAllBrands()[selectedBrand - 1]; while (run) { //Send the patterns of the selected brand b.kill(this); } } }
From source file:com.google.samples.apps.iosched.debug.actions.ShowSessionNotificationDebugAction.java
@Override public void run(Context context, Callback callback) { Intent i = new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri("__keynote__")); PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); Intent mapIntent = new Intent(context, MapActivity.class); mapIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME); mapIntent.putExtra(MapActivity.EXTRA_ROOM, "keynote"); PendingIntent piMap = TaskStackBuilder.create(context).addNextIntent(mapIntent).getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT); //= PendingIntent.getActivity(context, 0, mapIntent, 0); NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) .setContentTitle("test notification").setContentText("yep, this is a test") .setTicker("hey, you got a test") .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE) .setSmallIcon(R.drawable.ic_stat_notification).setContentIntent(pi) .setPriority(Notification.PRIORITY_MAX).setAutoCancel(true); notifBuilder.addAction(R.drawable.ic_map_holo_dark, context.getString(R.string.title_map), piMap); NotificationCompat.InboxStyle richNotification = new NotificationCompat.InboxStyle(notifBuilder) .setBigContentTitle(/*w w w. j a v a 2s. c om*/ context.getResources().getQuantityString(R.plurals.session_notification_title, 1, 8, 1)); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(32534, richNotification.build()); }
From source file:com.saarang.samples.apps.iosched.ui.debug.actions.ShowSessionNotificationDebugAction.java
@Override public void run(Context context, Callback callback) { Intent i = new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri("__keynote__")); PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); Intent mapIntent = new Intent(context, UIUtils.getMapActivityClass(context)); mapIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME); mapIntent.putExtra(BaseMapActivity.EXTRA_ROOM, "keynote"); PendingIntent piMap = TaskStackBuilder.create(context).addNextIntent(mapIntent).getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT); //= PendingIntent.getActivity(context, 0, mapIntent, 0); NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) .setContentTitle("test notification").setContentText("yep, this is a test") .setTicker("hey, you got a test") .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE) .setSmallIcon(com.saarang.samples.apps.iosched.R.drawable.ic_stat_notification).setContentIntent(pi) .setPriority(Notification.PRIORITY_MAX).setAutoCancel(true); notifBuilder.addAction(com.saarang.samples.apps.iosched.R.drawable.ic_map_holo_dark, context.getString(com.saarang.samples.apps.iosched.R.string.title_map), piMap); NotificationCompat.InboxStyle richNotification = new NotificationCompat.InboxStyle(notifBuilder) .setBigContentTitle(context.getResources().getQuantityString( com.saarang.samples.apps.iosched.R.plurals.session_notification_title, 1, 8, 1)); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(32534, richNotification.build()); }
From source file:com.google.samples.apps.iosched.ui.debug.actions.ShowSessionNotificationDebugAction.java
@Override public void run(Context context, Callback callback) { Intent i = new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri("__keynote__")); PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); Intent mapIntent = new Intent(context, UIUtils.getMapActivityClass(context)); mapIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME); mapIntent.putExtra(BaseMapActivity.EXTRA_ROOM, "keynote"); PendingIntent piMap = TaskStackBuilder.create(context).addNextIntent(mapIntent).getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT); //= PendingIntent.getActivity(context, 0, mapIntent, 0); NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) .setContentTitle("test notification").setContentText("yep, this is a test") .setTicker("hey, you got a test") .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE) .setSmallIcon(R.drawable.ic_stat_notification).setContentIntent(pi) .setPriority(Notification.PRIORITY_MAX).setAutoCancel(true); notifBuilder.addAction(R.drawable.ic_map_holo_dark, context.getString(R.string.title_map), piMap); NotificationCompat.InboxStyle richNotification = new NotificationCompat.InboxStyle(notifBuilder) .setBigContentTitle(//from ww w .j a va 2s . co m context.getResources().getQuantityString(R.plurals.session_notification_title, 1, 8, 1)); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(32534, richNotification.build()); }
From source file:com.example.fiveguys.trip_buddy_v0.fcm.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. *//*w w w .j a va 2s . co m*/ public static void sendNotification(Context context, String messageBody, String channelUrl) { Intent intent = new Intent(context, com.example.fiveguys.trip_buddy_v0.main.ChatActivity.class); intent.putExtra("groupChannelUrl", channelUrl); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0 /* Request code */, intent, PendingIntent.FLAG_UPDATE_CURRENT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(context.getResources().getString(R.string.app_name)).setContentText(messageBody) .setAutoCancel(true).setSound(defaultSoundUri).setPriority(Notification.PRIORITY_MAX) .setDefaults(Notification.DEFAULT_ALL).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:org.gluu.super_gluu.util.FakeDataUtil.java
public static void sendNotification(Context context) { NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); String contentText = "Example Content Text"; NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, GluuApplication.CHANNEL_ID).setContentIntent(getFakePendingIntent(context)) .setSmallIcon(R.drawable.push_icon).setSound(defaultSoundUri) .setContentTitle("Example Title").setContentText(contentText) .setStyle(new NotificationCompat.BigTextStyle().bigText(contentText)) .setChannelId(GluuApplication.CHANNEL_ID).setDefaults(Notification.DEFAULT_ALL) .setAutoCancel(true).setVibrate(new long[] { 100, 250, 100, 250, 100, 250 }) .setPriority(Notification.PRIORITY_MAX) .addAction(R.drawable.deny_icon_push, "Deny", getFakePendingIntent(context)) .addAction(R.drawable.approve_icon_push, "Approve", getFakePendingIntent(context)); if (notificationManager != null) { notificationManager.notify(MainNavDrawerActivity.MESSAGE_NOTIFICATION_ID, notificationBuilder.build()); }// w w w . j a v a 2 s . co m }
From source file:com.app.encontreibvrr.service.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. * * @param messageBody FCM message body received. *//* w w w .j a v a 2 s .c o m*/ private void sendNotification(String messageBody) { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); //Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher).setPriority(Notification.PRIORITY_MAX) .setDefaults(Notification.DEFAULT_ALL).setVisibility(Notification.VISIBILITY_PUBLIC) .setContentTitle("Encontrei BV RR").setContentText(messageBody).setAutoCancel(true) .setSound(defaultSoundUri).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:com.nkc.education.service.NotificationHelper.java
/** * Basic Text Notification for Task Butler, using NotificationCompat * * @param context//from w w w . j a v a2 s . c om */ public void sendBasicNotification(Context context, Task task) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean vibrate = prefs.getBoolean(AppConfig.VIBRATE_ON_ALARM, true); int alarmInterval; int alarmUnits; if (task.hasFinalDateDue()) { alarmInterval = Integer.parseInt(prefs.getString(AppConfig.ALARM_TIME, AppConfig.DEFAULT_ALARM_TIME)); alarmUnits = Calendar.MINUTE; } else { alarmInterval = Integer .parseInt(prefs.getString(AppConfig.REMINDER_TIME, AppConfig.DEFAULT_REMINDER_TIME)); alarmUnits = Calendar.HOUR_OF_DAY; } Calendar next_reminder = GregorianCalendar.getInstance(); next_reminder.add(alarmUnits, alarmInterval); Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher); NotificationCompat.Builder builder = new NotificationCompat.Builder(context).setAutoCancel(true) .setContentIntent(getPendingIntent(context, task.getID())) .setContentInfo(Task.PRIORITY_LABELS[task.getPriority()]).setContentTitle(task.getName()) .setContentText(task.getDetail()) .setDefaults(vibrate ? Notification.DEFAULT_ALL : Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS) .setSmallIcon(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? R.drawable.ic_exam_name : R.drawable.ic_exam_name) .setLargeIcon(bitmap).setTicker(task.getName()).setPriority(Notification.PRIORITY_MAX) .setColor(Color.argb(255, 21, 149, 196)).setWhen(System.currentTimeMillis()); @SuppressWarnings("deprecation") Notification notification = builder.getNotification(); NotificationManager notificationManager = getNotificationManager(context); notificationManager.notify(task.getID(), notification); }
From source file:com.sikware.FixMyLife.fcm.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. * * @param messageBody FCM message body received. */// w w w . j a va 2 s .c om public static void sendNotification(Context context, String messageBody, String channelUrl) { Intent intent = new Intent(context, GroupChannelActivity.class); intent.putExtra("groupChannelUrl", channelUrl); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0 /* Request code */, intent, PendingIntent.FLAG_UPDATE_CURRENT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.mipmap.sendbird_ic_launcher) .setContentTitle(context.getResources().getString(R.string.app_name)).setContentText(messageBody) .setAutoCancel(true).setSound(defaultSoundUri).setPriority(Notification.PRIORITY_MAX) .setDefaults(Notification.DEFAULT_ALL).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }