Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: FCM java.io.IOException: SERVICE_NOT_AVAILABLE error on some devices

I use FCM in my project

It work correct on Sony xperia, Galaxy S6, Motorola and more. But on Galaxy S3 i get java.io.IOException: SERVICE_NOT_AVAILABLE error

Time of Galaxy S3 is auto and google play is updated

Internet connection is strong and i connected to open internet without proxy

like image 242
Te Me Avatar asked May 07 '18 06:05

Te Me


People also ask

What is device FCM token?

Firebase Cloud Messaging (FCM) is a messaging solution that lets you reliably send messages at no cost to both Android & iOS devices. Using FCM, you can send data payloads (via a message) to a device for a specific application. Each message can transfer a payload of up to 4KB to a client.


2 Answers

This error is caused when the device is unable to register to Firebase. Make sure the internet is working when this code is called. And put the code within try-catch to stop app from crashing.

Edit: Either add an internet connection check before registering the device or fetching token. Or wrap the Fetch token code in try-catch block to prevent app from crashing.

like image 180
Insane Developer Avatar answered Sep 24 '22 09:09

Insane Developer


Check following:

1- Internet connection

2- Phone date/time to be correct

like image 35
Hamed Jaliliani Avatar answered Sep 25 '22 09:09

Hamed Jaliliani