通知无法接受频道ID

时间:2018-02-06 10:52:45

标签: android firebase firebase-cloud-messaging

在下面的代码通知中但是它不能接受..(火焰通知)

  

错误:(82,17)错误:类Builder中的构造函数构建器无法应用于给定类型;       必需:上下文       发现:MyFirebaseMessagingService,String       原因:实际和正式的参数列表长度不同

String channelId = getString(R.string.default_notification_channel_id);
        Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        NotificationCompat.Builder notificationBuilder =
                new NotificationCompat.Builder(this, channelId) // error it cant accpet
                        .setSmallIcon(R.drawable.esap)
                        .setContentTitle(messageBody.get("title"))
                        .setContentText(messageBody.get("message"))
                        .setAutoCancel(true)
                        .setSound(defaultSoundUri)
                        .setContentIntent(pendingIntent);

        NotificationManager notificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

0 个答案:

没有答案