1
Oreo 장치에서 Firebase 메시징을 사용하려고하는데, 채널이 만들어지고 있는데도 적절한 채널에서 데이터를 수신 할 수 없습니다. (참고 :이 있지만 장치, 에뮬레이터에서 작동하지 않습니다)Oreo 알림 - 채널이 작동하지 않습니다.
다음public class MessagingService extends FirebaseMessagingService {
private static final String TAG = "MessagingService";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.d(TAG, "Message received for topic: " + remoteMessage.getFrom());
}
}
은 무엇입니까 : 여기
public class FCMPlayApp extends Application {
@Override
public void onCreate() {
super.onCreate();
FirebaseMessaging.getInstance().subscribeToTopic(MessagingConstants.TOPIC_ALL);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel();
}
}
@RequiresApi(Build.VERSION_CODES.O)
private void createNotificationChannel() {
NotificationChannel allChannel = new NotificationChannel(
"channel_all", "All Channel", NotificationManager.IMPORTANCE_HIGH);
((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
.createNotificationChannel(allChannel);
}
}
내 메시징 서비스 클래스입니다
이 내 응용 프로그램 클래스입니다 기본 채널에 대한 Android 매니페스트에 정의했습니다.
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="channel_all"/>
다음은 내가 사용하고있는 채널입니다. 푸시 메시지에 대한 우체부 도구 :
{
"to": "/topics/all",
"data": {
"msg_bg_color" : "#ABCDEF"
},
"notification": {
"body": "Hello",
"title": "This is test message."
},
"android_channel_id" : "channel_all"
}
당신은 제가 놓친 거지 무엇으로 알려 주시기 바랍니다 수 있습니다.
logcat에서 더 많은 로그를 제공 할 수 있습니까? –
android_channel_id는 알림 페이로드 안에 있어야합니다. 충돌이 어차피 발생하지 않아야하므로 더 많은 로그를 공유하십시오. –
@DiegoGiorgini 이상한 부분은 앱이 포 그라운드에있을 때 알림을받을 수없고 앱이 예상대로 작동하고 있다는 것입니다. 그러나 백그라운드에서 충돌이 발생하지만 로그가 없으면 중지됩니다. 알림 페이로드 내부에서 android_channel_id를 이동했지만 여전히 도움이되지 않습니다. – Soumya