Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error getting FCM token : java.io.IOException: PHONE_REGISTRATION_ERROR #1788

Closed
1 task done
arpitkushwaha opened this issue Jul 28, 2023 · 6 comments
Closed
1 task done

Comments

@arpitkushwaha
Copy link

arpitkushwaha commented Jul 28, 2023

What happened?

Not able to get/generate FCM tokens on some devices like Realme etc. Google Play Services are installed and functioning correctly on the affected device.

Getting below exception while trying to generate/fetch the token.

java.io.IOException: PHONE_REGISTRATION_ERROR

Firebase Messaging version: 23.0.0

Steps to reproduce?

1. Try to get/generate the FCM token on the affected device.
2. Get status as task is not successful and exception as `java.io.IOException: PHONE_REGISTRATION_ERROR`

What did you expect to happen?

The FCM token should generate on the device so that notifications can work.

OneSignal Android SDK version

Release 4.8.6

Android version

13, 12

Specific Android models

Realme X7 Max (Model : RMX3031), AndroidOS: 13

Relevant log output

Error Getting FCM Token
                 java.lang.Exception: java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: PHONE_REGISTRATION_ERROR
                 	at com.onesignal.PushRegistratorAbstractGoogle.attemptRegistration(PushRegistratorAbstractGoogle.java:125)
                 	at com.onesignal.PushRegistratorAbstractGoogle.access$100(PushRegistratorAbstractGoogle.java:37)
                 	at com.onesignal.PushRegistratorAbstractGoogle$1.run(PushRegistratorAbstractGoogle.java:84)
                 	at java.lang.Thread.run(Thread.java:1012)
                 Caused by: java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: PHONE_REGISTRATION_ERROR
                 	at com.google.firebase.messaging.FirebaseMessaging.blockingGetToken(com.google.firebase:firebase-messaging@@23.0.0:9)
                 	at com.google.firebase.messaging.FirebaseMessaging.lambda$getToken$3$com-google-firebase-messaging-FirebaseMessaging(com.google.firebase:firebase-messaging@@23.0.0:1)
                 	at com.google.firebase.messaging.FirebaseMessaging$$ExternalSyntheticLambda10.run(Unknown Source:4)
                 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
                 	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
                 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
                 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
                 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
                 	at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.2.0:2)
                 	at java.lang.Thread.run(Thread.java:1012)
                 Caused by: java.util.concurrent.ExecutionException: java.io.IOException: PHONE_REGISTRATION_ERROR
                 	at com.google.android.gms.tasks.Tasks.zza(com.google.android.gms:play-services-tasks@@18.0.2:5)
                 	at com.google.android.gms.tasks.Tasks.await(com.google.android.gms:play-services-tasks@@18.0.2:8)
                 	at com.google.firebase.messaging.FirebaseMessaging.blockingGetToken(com.google.firebase:firebase-messaging@@23.0.0:8)
                 	at com.google.firebase.messaging.FirebaseMessaging.lambda$getToken$3$com-google-firebase-messaging-FirebaseMessaging(com.google.firebase:firebase-messaging@@23.0.0:1)
                 	at com.google.firebase.messaging.FirebaseMessaging$$ExternalSyntheticLambda10.run(Unknown Source:4)
                 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
                 	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
                 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
                 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
                 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
                 	at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.2.0:2)
                 	at java.lang.Thread.run(Thread.java:1012)
                 Caused by: java.io.IOException: PHONE_REGISTRATION_ERROR
                 	at com.google.firebase.messaging.GmsRpc.handleResponse(com.google.firebase:firebase-messaging@@23.0.0:7)
                 	at com.google.firebase.messaging.GmsRpc.lambda$extractResponseWhenComplete$0$com-google-firebase-messaging-GmsRpc(com.google.firebase:firebase-messaging@@23.0.0:1)
                 	at com.google.firebase.messaging.GmsRpc$$ExternalSyntheticLambda0.then(Unknown Source:2)
                 	at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.2:3)
                 	at com.google.firebase.messaging.GmsRpc$$ExternalSyntheticLambda1.execute(Unknown Source:0)
                 	at com.google.android.gms.tasks.zzd.zzd(com.google.android.gms:play-services-tasks@@18.0.2:1)
                 	at com.google.android.gms.tasks.zzr.zzb(com.google.android.gms:play-services-tasks@@18.0.2:5)
                 	at com.google.android.gms.tasks.zzw.zzb(com.google.android.gms:play-services-tasks@@18.0.2:3)
                 	at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.2:8)
                 	at com.google.android.gms.cloudmessaging.zzz.execute(Unknown Source:0)
                 	at com.google.android.gms.tasks.zzd.zzd(com.google.android.gms:play-services-tasks@@18.0.2:1)
                 	at com.google.android.gms.tasks.zzr.zzb(com.google.android.gms:play-services-tasks@@18.0.2:5)
                 	at com.google.android.gms.tasks.zzw.zzb(com.google.android.gms:play-services-tasks@@18.0.2:3)
                 	at com.google.android.gms.tasks.TaskCompletionSource.setResult(com.google.android.gms:play-services-tasks@@18.0.2:1)
                 	at com.google.android.gms.cloudmessaging.zzp.zzd(com.google.android.gms:play-services-cloud-messaging@@17.0.0:3)
                 	at com.google.android.gms.cloudmessaging.zzr.zza(com.google.android.gms:play-services-cloud-messaging@@17.0.0:2)
                 	at com.google.android.gms.cloudmessaging.zzf.handleMessage(com.google.android.gms:play-services-cloud-messaging@@17.0.0:14)
                 	at android.os.Handler.dispatchMessage(Handler.java:102)
                 	at android.os.Looper.loopOnce(Looper.java:240)
                 	at android.os.Looper.loop(Looper.java:351)
                 	at android.app.ActivityThread.main(ActivityThread.java:8381)
	at java.lang.reflect.Method.invoke(Native Method)
                 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
                 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
 registerForPushToken completed with id: null status: -11


Topic sync or token retrieval failed on hard failure exceptions: java.util.concurrent.ExecutionException: java.io.IOException: PHONE_REGISTRATION_ERROR. Won't retry the operation.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

Hi @arpitkushwaha thanks for reaching out!

Can you please make sure you can log into the Google Play store on the device and can download an app to make sure the device can fully authenticate with Google?

This seems that it may be device-related; can you please try a different device like the Android Studio emulator and let us know the results?

Thanks!

@arpitkushwaha
Copy link
Author

arpitkushwaha commented Jul 31, 2023

Hi, @jennantilla Thanks a lot for the quick response.

Yes, we can log into Google Play Store on the device and can download apps from there. We also checked for Google Play Services and those are present.

It is working fine on the Android Studio emulator. But it is occurring for other devices like Realme, Samsung, etc. that too on different AndroidOS 13, 12, 11. and it is reproducing for a lot of devices without any specific pattern.

Is there anything we can do to identify the root cause? Or do you have any suggestions on how to handle this?

@arpitkushwaha
Copy link
Author

Hello @jennantilla, Did you find anything?

@arpitkushwaha
Copy link
Author

Hello @jennantilla, I would greatly appreciate it if you could kindly share some insights regarding this matter. Your input would be tremendously valuable to us, as this issue is currently affecting the performance of our product. Your assistance would be highly regarded. Thank you in advance.

@jennantilla
Copy link
Contributor

Hello @arpitkushwaha apologies that I've missed responding back to you.

Is this still a current concern? PHONE_REGISTRATION_ERROR is an error thrown by Firebase but I couldn't find any specifics other than the "Google Play services" app on the device is having an issue.

You could also try a fresh install and see if that helps.

Thanks!

@jkasten2
Copy link
Member

jkasten2 commented Apr 11, 2024

@arpitkushwaha The PHONE_REGISTRATION_ERROR error means something went wrong talking to Google's API. There is little this SDK can do with such an internal error expect for retry, which the OneSignal SDK is already doing.

The device itself either has an issue or it has an issue connecting to Google's servers. You can try some of the suggestions from others who have seen this issue:

The only official reference from Google themselves on this issue is noted here:

/** Incorrect phone registration with Google. This phone doesn't currently support C2DM. */
public static final String ERR_PHONE_REGISTRATION_ERROR = "PHONE_REGISTRATION_ERROR";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants