List of usage examples for android.app NotificationManager IMPORTANCE_LOW
int IMPORTANCE_LOW
To view the source code for android.app NotificationManager IMPORTANCE_LOW.
Click Source Link
From source file:com.android.contacts.util.ContactsNotificationChannelsUtil.java
public static void createDefaultChannel(Context context) { if (!BuildCompat.isAtLeastO()) { return;// w w w . j a va 2s. c o m } final NotificationManager nm = context.getSystemService(NotificationManager.class); final NotificationChannel channel = new NotificationChannel(DEFAULT_CHANNEL, context.getString(R.string.contacts_default_notification_channel), NotificationManager.IMPORTANCE_LOW); nm.createNotificationChannel(channel); }
From source file:chat.viska.android.Application.java
private void initializeNotificationChannels() { if (Build.VERSION.SDK_INT >= 26) { final NotificationManager manager = getSystemService(NotificationManager.class); final NotificationChannel systemChannel = new NotificationChannel(KEY_NOTIF_CHANNEL_SYSTEM, getString(R.string.title_notif_channel_system), NotificationManager.IMPORTANCE_LOW); systemChannel.setDescription(getString(R.string.desc_notif_channel_system)); systemChannel.enableVibration(false); systemChannel.enableLights(false); systemChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); systemChannel.setShowBadge(false); manager.createNotificationChannel(systemChannel); final NotificationChannel messagingChannel = new NotificationChannel(KEY_NOTIF_CHANNEL_MESSAGES, getString(R.string.title_notif_channel_messaging), NotificationManager.IMPORTANCE_HIGH); systemChannel.setDescription(getString(R.string.desc_notif_channel_messaging)); systemChannel.enableVibration(true); systemChannel.enableLights(true); systemChannel.setLockscreenVisibility(Notification.VISIBILITY_SECRET); systemChannel.setShowBadge(true); manager.createNotificationChannel(messagingChannel); }//from w w w . jav a 2s .c o m }
From source file:com.davidmiguel.gobees.utils.NotificationsHelper.java
@RequiresApi(Build.VERSION_CODES.O) private void createMonitoringChannel() { NotificationChannel channel = new NotificationChannel(MONITORING_CHANNEL, getString(R.string.not_channel_monitoring), NotificationManager.IMPORTANCE_LOW); channel.setDescription(getString(R.string.not_channel_monitoring_desc)); channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); channel.setShowBadge(false);//from w w w. ja va 2 s . c o m channel.enableLights(false); getManager().createNotificationChannel(channel); }
From source file:org.deviceconnect.android.deviceplugin.host.recorder.AbstractPreviewServerProvider.java
/** * Notification??./*from w w w . j a va 2 s .c o m*/ */ public void sendNotification() { PendingIntent contentIntent = createPendingIntent(); Notification notification = createNotification(contentIntent, null); NotificationManager manager = (NotificationManager) mContext.getSystemService(Service.NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { String channelId = mContext.getResources().getString(R.string.overlay_preview_channel_id); NotificationChannel channel = new NotificationChannel(channelId, mContext.getResources().getString(R.string.overlay_preview_content_title), NotificationManager.IMPORTANCE_LOW); channel.setDescription(mContext.getResources().getString(R.string.overlay_preview_content_message)); manager.createNotificationChannel(channel); notification = createNotification(contentIntent, channelId); } manager.notify(getId(), getNotificationId(), notification); }
From source file:com.readystatesoftware.chuck.internal.support.NotificationHelper.java
public NotificationHelper(Context context) { this.context = context; notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { notificationManager.createNotificationChannel(new NotificationChannel(CHANNEL_ID, context.getString(R.string.notification_category), NotificationManager.IMPORTANCE_LOW)); try {//from ww w . j a va2s. c om setChannelId = NotificationCompat.Builder.class.getMethod("setChannelId", String.class); } catch (Exception ignored) { } } }
From source file:org.LK8000.MyService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { /* add an icon to the notification area while LK8000 runs, to remind the user that we're sucking his battery empty */ final String CHANNEL_ID = getApplicationContext().getPackageName() + "_NotificationChannel"; NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // Support for Android Oreo: Notification Channels NotificationChannel channel = manager.getNotificationChannel(CHANNEL_ID); if (channel == null) { channel = new NotificationChannel(CHANNEL_ID, "LK8000", NotificationManager.IMPORTANCE_LOW); manager.createNotificationChannel(channel); }/*from w ww. ja va 2s . c om*/ } Intent intent2 = new Intent(this, mainActivityClass); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent2, 0); NotificationCompat.Builder notification = new NotificationCompat.Builder(this, CHANNEL_ID); notification.setSmallIcon(R.drawable.notification_icon); notification.setLargeIcon(BitmapFactory.decodeResource(getResources(), getApplicationInfo().icon)); notification.setContentTitle("LK8000 is running"); notification.setContentText("Touch to open"); notification.setContentIntent(contentIntent); notification.setWhen(System.currentTimeMillis()); notification.setShowWhen(false); notification.setOngoing(true); notification.setOnlyAlertOnce(true); startForeground(1, notification.build()); /* We want this service to continue running until it is explicitly stopped, so return sticky */ return START_STICKY; }
From source file:com.commonsware.android.service.lifecycle.DemoService.java
@TargetApi(Build.VERSION_CODES.O) private void initChannels() { NotificationChannel channel = new NotificationChannel(CHANNEL_MIN, getString(R.string.channel_min), NotificationManager.IMPORTANCE_MIN); mgr.createNotificationChannel(channel); channel = new NotificationChannel(CHANNEL_LOW, getString(R.string.channel_low), NotificationManager.IMPORTANCE_LOW); mgr.createNotificationChannel(channel); }
From source file:com.commonsware.android.notify.channel.MainActivity.java
private void initContentChannel() { NotificationChannel channel = new NotificationChannel(CHANNEL_CONTENT, getString(R.string.channel_name_content), NotificationManager.IMPORTANCE_LOW); channel.setGroup(GROUP_UPDATES);/*from w w w .ja v a 2 s.c om*/ mgr.createNotificationChannel(channel); }
From source file:org.mozilla.focus.session.SessionNotificationService.java
public void createNotificationChannelIfNeeded() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { // Notification channels are only available on Android O or higher. return;/* w ww . j av a 2s .com*/ } final NotificationManager notificationManager = getSystemService(NotificationManager.class); if (notificationManager == null) { return; } final String notificationChannelName = getString(R.string.notification_browsing_session_channel_name); final String notificationChannelDescription = getString( R.string.notification_browsing_session_channel_description, getString(R.string.app_name)); final NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, notificationChannelName, NotificationManager.IMPORTANCE_MIN); channel.setImportance(NotificationManager.IMPORTANCE_LOW); channel.setDescription(notificationChannelDescription); channel.enableLights(false); channel.enableVibration(false); channel.setShowBadge(true); notificationManager.createNotificationChannel(channel); }
From source file:de.linuxwhatelse.android.notify.activities.MainActivity.java
private void initChannels(Context context, String channelName) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { return;/*w w w. j a va 2 s.co m*/ } NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel channel = new NotificationChannel(Notify.NOTIFICATION_CHANNEL, channelName, NotificationManager.IMPORTANCE_LOW); notificationManager.createNotificationChannel(channel); }