【发布时间】:2019-07-15 13:12:08
【问题描述】:
这是我的代码: 在这段代码中显示错误
getString(R.string.default_notification_channel_id))
这是完整的代码:
public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
String messageTitle = remoteMessage.getNotification().getTitle();
String messageBody = remoteMessage.getNotification().getBody();
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, getString(R.string.default_notification_channel_id))
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(messageTitle)
.setContentText(messageBody)
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
int mNotificationId = (int) System.currentTimeMillis();
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNotifyMgr.notify(mNotificationId,mBuilder.build());
}
}
【问题讨论】:
-
您在 logcat 中看到的内容发布。
-
这个字符串
default_notification_channel_id是否真的存在于你的字符串文件夹中... -
是
MyNewProject Hello空白片段 Supreme_CH_01 -
请不要滥用 cmets 发布代码。改为编辑您的问题并在此处添加信息。
-
您的支持库版本是多少?
标签: android builder build-script