2017-08-25 2 views

Antwort

1

Wir werden mehr Einzelheiten benötigen wie der Code oder etwas, aber ich denke, dass Sie einen Benachrichtigungskanal mit einer bestimmten Kanal-ID erstellen müssen.

NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 
String id = "my_channel_01"; 
int importance = NotificationManager.IMPORTANCE_LOW; 
NotificationChannel mChannel = new NotificationChannel(id, name,importance); 
mChannel.enableLights(true); 
mNotificationManager.createNotificationChannel(mChannel); 

erste Weg ist, Kanal für die Benachrichtigung in Konstruktor gesetzt:

Notification notification = new Notification.Builder(MainActivity.this , id).setContentTitle("Title"); 
mNotificationManager.notify("your_notification_id", notification); 

zweite Weg ist, um den Kanal durch Notificiation.Builder.setChannelId()

Notification notification = new Notification.Builder(MainActivity.this).setContentTitle("Title"). 
setChannelId(id); 
mNotificationManager.notify("your_notification_id", notification); 

Hoffnung zu setzen, das hilft

Verwandte Themen