Firebasecloudmessaging : Firebaseinstanceid Background Sync Failed - Service_not_available
Solution 1:
- Verify internet connectivity
- Verify if the Android SDK tools(Tools -> Android -> SDK manager -> SDK tools tab) has 'Google Play services' latest version and if not install the package. Then if you are using emulator, please stop the emulator and start it again.It works
Solution 2:
You can check
- Check your internet connection with no proxy and open internet connect
- Replace your
google-service.json
with new one you can get this in firebaseconsol - Please check your device has google play service in it and it working or not , firebase not work without google play service
Solution 3:
After long struggle i found the answer, if google play service is not running then FirebaseInstanceId background sync failed - SERVICE_NOT_AVAILABLE
log print, so you can check your google play service is running properly or not ?
May be this information is helpful to you !
Solution 4:
the service needs to be bound in the Manifest.xml
<!-- Firebase InstanceId Service --><serviceandroid:name="eu.acme.service.FireBaseInstanceIdService"android:exported="false" ><intent-filter><actionandroid:name="com.google.firebase.INSTANCE_ID_EVENT"/></intent-filter></service>
then one can access one single exposed method (the other names are obfuscated = not reliable):
package eu.acme.service;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
publicclassFireBaseInstanceIdServiceextendsFirebaseInstanceIdService {
@Override@android.support.annotation.WorkerThread
publicvoidonTokenRefresh() {
/* obtain the current InstanceId token: */Stringtoken= FirebaseInstanceId.getInstance().getToken();
}
}
one could only work around it, by not provoking it, eg. by not adding any AuthState Listener while knowing that there is no active network present, as explained here - as it seems, one otherwise cannot catch the exception thrown from within the library - which can be ignored, since it merely just complains, that there is no network connectivity.
com.google.android.gms.iid and com.google.firebase.iid are about the same.
Solution 5:
I had to disbale my VPN - hope this helps someone !
Post a Comment for "Firebasecloudmessaging : Firebaseinstanceid Background Sync Failed - Service_not_available"