react-native-fcm: Device Token is null in some devices?
Is it possible that device_token can be null in some android devices?
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 14
- Comments: 26 (4 by maintainers)
Is it possible that device_token can be null in some android devices?
I keep having a null registration id on application first boot. Is there any news about that?
Try to change the device language.It worked for me š
I just figure out that in my case the problem is the company proxy server. The proxy was blocking the request to firebase and after I configure the proxy server properly to not block my device requests everything woks fine. I know this is a particular case but maybe can help someone.
I made THIS MODIFICATIONS on my forked version of this repo, this code force the refresh of token on firebase server. I really do not test yet, so if someone wants to implement this and do more tests, just feel free to do that.
@evollu I have the same issue here and after some researches I think that Firebase just send the device token in this particular cases:
But in my case for example, the token was generated on first time that the app was installed, after that, never more! I tried to uninstall/install the app and nothing happends! If anyone solve this problem, please, tell me, cause I have research everywhere and canāt find anything.
I solved this problem for my case. But Iām using Swift (iOS). After re-installing app and other actions my token was nil. I needed to wait didRefreshRegistrationToken function. So, Iām ignoring this nil with guard let token = Messaging.messaging().fcmToken else { return } and after this function func messaging(_ messaging: Messaging, didRefreshRegistrationToken fcmToken: String) { is getting called. Hope it helps someone
firebase class file
MainActivity LocalBroadcastManager.getInstance(this).registerReceiver(tokenReceiver, new IntentFilter(ātokenReceiverā));
BroadcastReceiver tokenReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { token = intent.getStringExtra(ātokenā); if(token != null) { }
This code working fine
can you try with Firebase native example? If you still see it, fire a bug to them
@evollu After try a lot of things to works on my device, I run in my emulator, and works. After that, I run in my device again and (I donāt know why) works too and (I donāt know why again) still working! ¬¬
I will try the native sample project anyway and I come back here to say what happends.
Tks a lot.