Android O reporting notification not posted to channel - but it is

前端 未结 8 1381
礼貌的吻别
礼貌的吻别 2020-12-05 06:52

Couple Android O notification questions:

1) I have created a Notification Channel (see below), am calling the builder with .setChannelId() (passing in the name of th

8条回答
  •  感情败类
    2020-12-05 07:01

    create a notification using following code :

        Notification notification = new Notification.Builder(MainActivity.this)
                  .setContentTitle("New Message")
                            .setContentText("You've received new messages.")
                            .setSmallIcon(R.mipmap.ic_launcher)
                            .setChannelId(channelId)
                            .build();
    

    not using :

    Notification notification = new NotificationCompat.Builder(MainActivity.this)
                        .setContentTitle("Some Message")
                        .setContentText("You've received new messages!")
                        .setSmallIcon(R.mipmap.ic_launcher)
                        .setChannel(channelId)
                        .build();
    

提交回复
热议问题