edismooth / ionic2-firebase

[DEPRECATED] Easy example of Firebase working with Ionic 2.
33 stars 16 forks source link

token return null #4

Open shamrozwarraich opened 7 years ago

shamrozwarraich commented 7 years ago

thanks aaaaaaaaloot boss..your app work like charm ... but alert of token show me null value... can can u plz help me to using rest api...

edismooth commented 7 years ago

@shamrozwarraich hi, can you tell me more about your problem? Sorry for long waiting time- I was on vacations.

shamrozwarraich commented 7 years ago

token prblm solve but am using fcm server to send the notifcation but when the app is off the notification not display ... :/

eheading commented 7 years ago

I would like to save the token to local storage and read it from the other page of the APP. However, I can't save it to the local storage in my below syntax. May I know which part I am wrong? Many thanks.

initializeApp() {
        this.platform.ready().then(() => {
            StatusBar.styleDefault();
            FCMPlugin.getToken(
                function (token) {
                    console.log(token);
                    this.local.set('tokenvalue', token); // the token value can't be saved like this
                },
                function (err) {
                    console.log('error retrieving token: ' + err);
                }
            );
}