Closed patrikmasiar closed 5 years ago
It isn’t documented very well, but I believe this is either a network connectivity failure or a server error of some sort. Recommendation is exponential backoff/retry. The token calls have latency anyway, so your calling code should already be able to handle it async, it just may take longer (or fail completely if there’s a network hiccup)
provisionally closing as all the docs I read indicated this was network related, and not a problem with the module, additionally I’ve been running e2e tests this morning on the module, they call getToken and have been working so I can’t reproduce
I am also facing this issue only after I enable progaurd along with migration to androidx, please suggest something
@shubham1164 can you confirm you have done this? https://rnfirebase.io/docs/v5.x.x/installation/android#Using-with-Proguard-enabled
And if it is just related to AndroidX you might be seeing a difference between R8 (new minify toolchain on Android) and ProGuard. You can disable R8 (I think, until they remove the option) https://android-developers.googleblog.com/2018/04/android-studio-switching-to-d8-dexer.html
Yes, I have used all these but still no success until I added an additional config in the proguard:
-keep class com.google.firebase.* { ; }
It's working now. I don't know if it is fine to include the above line. Thanks
I don't think that will hurt you other than potentially keeping around a lot of classes that it may correctly delete, but that is better than incorrectly purging a class you need
That said, I notice your versions are old, I wonder if you upgraded to new versions of gradle + gradle plugin, and the version of firebase/play services right before they went androidx, along with react-native-firebase v5.5.x if you would still see this problem even without the proguard addition. I have updated versions and don't see this myself
Thank you @mikehardy I will surely try that
I have same problem ..... i want to do Push notification by firebase in android and i am doing coding from https://rnfirebase.io/docs/v5.x.x/installation/android#Using-with-Proguard-enabled ...... and i am getting error ;- Possible Uhandeled Promis Rejection ( id:1) Error: SERVICE_NOT_AVILABLE .... please help its urgent
I am also getting same error Error: SERVICE_NOT_AVAILABLE in android. Please give any suggestions.I tried this -keep class com.google.firebase.** { *; }
but no luck for me.
did anyone found any solution?
Any updates on this. Facing same thing with android
Any updates on this. Facing same thing with android
Any updates on this. Facing same thing with android. I also get this error message:
messaging/fcm-token-error authentication failed
For me the issue was the internet connection of my macbook. Changing the network did the trick.
This is absolutely network issue. If you are running in android emulator, kindly check wifi and mobile data aswll. sometimes for no emulator network connection is terminated. Then just close and open the emulator.
If you are running in Android emulator, try this answer from SO https://stackoverflow.com/questions/4376553/upgraded-to-sdk-2-3-now-no-emulators-have-connectivity
Or change your DNS to 8.8.8.8 and restart your emulator
In case you may experience this on a HUAWEI device, it might just hint for that Google Play Services are not installed (and so there won't be any "Background Data Access"). When I run the very same application on a Motorola device or an x86 emulator, it doesn't complain at all ...particularly with Harmony OS 2.0 (I'm talking of 2021), there doesn't seem to be any way to properly install Google Play Services, because they refuse to OEM unlock (it's probably no wonder that their "AppGallery" has little variety, but still lots of rubbish). Firebase Authentication still works... but nothing that would require the "Background Data Access".
For non-Google Play devices, this page is important to understand: https://firebase.google.com/docs/android/android-play-services - also, you might like https://rnfirebase.io/app/utils#android---checking-play-services
This is good news for me, because I barely use the libraries which would demand these (except the Google Play BillingClient
, which is not applicable in the HUAWEI "AppGallery" anyway)... you've probably just sold a tablet for them, which I've already RMA'd and may cancel (still got one week left for testing some of the scenarios). By building two flavors, I can even keep these libraries out of the package - or substitute accordingly.
Issue
Hi, I am using react-native-firebase for android push notifications. I have an issue with retrieving FCM token.
When I am logging error, it shows me: Error: SERVICE_NOT_AVAILABLE
react-native-firebase: 5.2.0
android/build.gradle
:classpath 'com.android.tools.build:gradle:3.1.4'
android/app/build.gradle
:react-native info
output:React Native Environment Info: System: OS: macOS 10.14.4 Binaries: Node: 11.5.0 npm: 6.9.0 Watchman: 4.9.0 SDKs: Android SDK: API Levels: 25, 27, 28, 29 Build Tools: 27.0.3, 28.0.3, 29.0.0 System Images: android-26 | Google APIs Intel x86 Atom npmPackages: react: ^16.6.3 => 16.6.3 react-native: ^0.57.8 => 0.57.8 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7