Problem description
When the Firebase token is updated, the on-change event isn't firing on Android.
Environment
- Tabris.js version: 3.0.0-beta2
- Devices:
- iPhone 7 with iOS 11.1.1
- HTC Desire 530 with Android 6.0.1
Code snippet
/* see existing token */
console.warn("Existing token: " + firebase.Messaging.token);
/* ask for permissions */
if (device.platform == 'iOS') firebase.Messaging.requestPermissions();
/* add on-change event for token */
firebase.Messaging.on('tokenChanged', ({token}) => {
console.warn("Got updated firebase token: " + token);
});
Output on iOS:
<!-- open app for first time -->
> Existing token: undefined
<!-- confirm or deny notification prompt -->
> Got updated firebase token: ...
Output on Android:
<!-- open app for first time -->
> Existing token: null
<!-- close & restart app -->
> Existing token: ...
Workaround
By setting an interval that repeatedly checks firebase.Messaging.token, you can essentially figure out when the token is updated. This creates needless overhead, though.
Problem description
When the Firebase token is updated, the on-change event isn't firing on Android.
Environment
Code snippet
Output on iOS:
Output on Android:
Workaround
By setting an interval that repeatedly checks
firebase.Messaging.token, you can essentially figure out when the token is updated. This creates needless overhead, though.