2017-08-25 3 views

答えて

1

私たちは、コードか何かのような、より詳細が必要になりますが、私は、あなたが特定のチャネルIDを通知チャネルを作成する必要があると思います。

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); 

最初の方法は、コンストラクタに通知するためのチャンネルを設定することです:

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

第二の方法は、Notificiation.Builder.setChannelId(でチャンネルを設定することです)

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

は、この情報がお役に立てば幸いです

関連する問題