내 응용 프로그램을 테스트하고있는 장치 중 일부에서 알림을받지 못하고 예외가 발생하지 않으므로 문제가 있습니다.일부 장치는 FCM 알림을 수신하지 않습니다.
알림은 FCM에서 제공되며 사용자 지정 서비스를 사용하여 표시하고 있습니다.
단지 안드로이드 6.0.1 희망을 뿌리 장치에서 일어나는 순간 MyFirebaseMessaginService.java
static int count = 0;
@Override
public void onMessageReceived(final RemoteMessage remoteMessage) {
Log.i("remoteMessage",remoteMessage.toString());
switch(remoteMessage.getData().get("tipo")){
case "normal":
notificacionNormal(remoteMessage);
break;
case "imagen":
notificacionImagen(remoteMessage);
break;
case "imagen+url":
notificacionImagenUrl(remoteMessage);
break;
}
count++;
//Log.d("prueba",remoteMessage.getData().get("imagen"));
}
private void notificacionImagenUrl(RemoteMessage remoteMessage) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(remoteMessage.getData().get("url")));
PendingIntent pendingIntent = PendingIntent.getActivity(this, 100, i, PendingIntent.FLAG_ONE_SHOT);
NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notif = new Notification.Builder(this)
.setContentIntent(pendingIntent)
.setContentTitle(remoteMessage.getNotification().getTitle())
.setContentText(remoteMessage.getNotification().getBody())
.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
.setStyle(new Notification.BigPictureStyle().bigPicture(getImagae(remoteMessage.getData().get("imagen"))))
.build();
notif.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(count, notif);
}
u는 나를 도울 수 :
이 편집 : 는 알림 HTTP 요청 I 보내 :
"to": "/topics/general",
"notification" : {
"title": "title",
"body": "body",
},
"data": {
"tipo": "normal",
}
샘플 페이로드를 게시 할 수 있습니까? 또한 일부 특정 장치에서만 발생하거나 모든 테스트 장치에서 무작위로 발생합니까? –
@intj 하나의 테스트 장치에서만 일어나는 일이며 anithing을받지 못합니다 (첫 번째 로그에 도달하지 못함). 그리고 재생 서비스가 장치에 설치됩니다. Wath는 재생 목록을 의미합니까? –
해당 장치에 해당하는 'registrationToken'이 수신자입니까? 나는 통보 페이로드를 언급했다. 아니면 Firebase 콘솔을 통해 알림을 보내고 있습니까? –