Android 8.0 ( API 26), . Android 8.0 ( API 26), Android 8.0 ( API 26), , Android 7.1 (API- 25) .
Android 8.0 ( API 26),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
String id = "id_product";
CharSequence name = "Product";
String description = "Notifications regarding our products";
int importance = NotificationManager.IMPORTANCE_MAX;
NotificationChannel mChannel = new NotificationChannel(id, name, importance);
mChannel.setDescription(description);
mChannel.enableLights(true);
mChannel.setLightColor(Color.RED);
notificationManager.createNotificationChannel(mChannel);
}
Builder
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(applicationContext, **ID you have put in the Notification Channel**)
, Builder
notificationManager.notify("0", notificationBuilder.build())
: https://developer.android.com/guide/topics/ui/notifiers/notifications.html#ManageChannels