Android

The registration token is not a valid FCM registration token

FCM 테스트하는 과정에서 오류가 발생하였다.

 

GCM 서비스가 종료되기 때문에 FCM 서비스로 갈아타야한다.

 

ERROR: The registration token is not a valid FCM registration token
com.google.firebase.messaging.FirebaseMessagingException: The registration token is not a valid FCM registration token
        at com.google.firebase.messaging.FirebaseMessagingClientImpl.newException(FirebaseMessagingClientImpl.java:306)
        at com.google.firebase.messaging.FirebaseMessagingClientImpl.createExceptionFromResponse(FirebaseMessagingClientImpl.java:211)
        at com.google.firebase.messaging.FirebaseMessagingClientImpl.send(FirebaseMessagingClientImpl.java:127)
        at com.google.firebase.messaging.FirebaseMessaging$1.execute(FirebaseMessaging.java:139)
        at com.google.firebase.messaging.FirebaseMessaging$1.execute(FirebaseMessaging.java:136)
        at com.google.firebase.internal.CallableOperation.call(CallableOperation.java:36)
        at com.google.firebase.messaging.FirebaseMessaging.send(FirebaseMessaging.java:106)
        at com.google.firebase.messaging.FirebaseMessaging.send(FirebaseMessaging.java:90)
        at .schedule.service.SendPush.sendToToken(SendPush.java:175)
        at .schedule.service.SendPush.executeSchedule(SendPush.java:115)
        at wellness.schedule.job.SendPushJob.executeInternal(SendPushJob.java:38)
        at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: com.google.api.client.http.HttpResponseException: 400 Bad Request
{
  “error”: {
    “code”: 400,
    “message”: “The registration token is not a valid FCM registration token”,
    “status”: “INVALID_ARGUMENT”,
    “details”: [
      {
        “@type”: “type.googleapis.com/google.firebase.fcm.v1.FcmError”,
        “errorCode”: “INVALID_ARGUMENT”
      },
      {
        “@type”: “type.googleapis.com/google.rpc.BadRequest”,
        “fieldViolations”: [
          {
            “field”: “message.token”,
            “description”: “The registration token is not a valid FCM registration token”
          }
        ]
      }
    ]
  }
}

        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1072)

 

오류원인 : 기존  GCM 사용시 사용했던 registration token를 사용하여 발생한 문제이다. 이전 사용자들의 GCM 토큰값들을 어떻게 FCM로 변경할지 고민해볼 필요가 있다.

FCM newToken()이 앱에서 호출되는 경우는 앱이 최초 설치되었을 경우로 알고 있기 때문이다.
그래서 기존 사용자들은 갱신이 안될 것 이다.

 

 

Leave a Reply

error: Content is protected !!