Push Notification Firebase


#1

belos is my code Next step how to send Push notification to specific mobile device.

INFO (i AM REFEREING) this site (native) : https://ionicframework.com/docs/native/firebase/

/* Get Firebase token /
this.firebase.getToken()
.then(token => {
this.token_id = token;
this.ls.setToken(token);
})
.catch(error => console.error(‘Error getting token’, error));
this.firebase.onTokenRefresh()
.subscribe((token: string) => console.log(Got a new token ${token}));
/
get localstorage user id /
this.ls.getUserid().then((user_id)=> {
/
Check User is login or not /
this.data.Islogin(user_id).subscribe(
data => {
this.results = data;
if(this.results[‘response’]==“yes”) {
/
check token */
this.data.fireToken(user_id,this.token_id).subscribe(
data => {
},
err => {
console.log(err);
},
() => console.log(‘Firebase call’));
this.rootPage = Mycontact;
}
if (this.results[‘response’]==‘no’) {
this.rootPage = Login;
}
},
err => {
console.log(err);
},
() => console.log(‘Login Form Complete’));
});
}


#2

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.


#3

Is it actually possible to receive notifications in the background only using Firebase ?
I have migrated from FCM to firebase and I do not receive the notifications anymore, though they get sent the same way, is there a reason why ?