Open vijaySlk opened 4 years ago
Hi @vijaySlk.
Would you explain what do you mean by "app kill"?
If the app is killed, it means that is not running, right?
app kill means app not running is right but after kill again app open then token value getting null
It makes sense. Because, this token is provided by the SDK, so if it is not yet re-fetched, the value would be null
.
Would you try something like this:
const getValidToken = () => new Promise((resolve, reject) => {
const success = (token: string) => {
if(!token) { return }
this.fcm.onTokenRefresh().unsubscribe(success);
resolve(token);
}
this.fcm.getToken().then(success).catch(reject);
this.fcm.onTokenRefresh().subscribe(success);
})
Then calling getValidToken
, would not resolve until a non-null value is retrieved.
now i have find one solution remove below plugin ionic cordova plugin add cordova-plugin-firebase-crashlytics npm install @ionic-native/firebase-crashlytics
this plugin conflict to FCM
@vijaySlk Conflicts are never good. Would you share which version you had installed? Just keep a note and check later.
Hi
@vijaySlk Conflicts are never good. Would you share which version you had installed? Just keep a note and check later.
Hi, I'm experiencing a similar issue where the token is sometimes null, on IOS. I believe your solution regarding promise resolve and reject could be the answer, but I want to under the steps inside the code, since I have some additional steps of my own. I would really appreciate it, if you would help me out with this.
@UsamaParkar I didn't understand what you meant by I want to under the steps inside the code, since I have some additional steps of my own
.
below my code