Ionic framework 在我们的爱奥尼亚4项目中有没有使用推送通知的方法?
我们目前有一个我们编码的爱奥尼亚和火基项目。在这个项目中,我们希望使用推送通知。但我们的问题是:Ionic framework 在我们的爱奥尼亚4项目中有没有使用推送通知的方法?,ionic-framework,push-notification,apple-push-notifications,ionic4,android-push-notification,Ionic Framework,Push Notification,Apple Push Notifications,Ionic4,Android Push Notification,我们目前有一个我们编码的爱奥尼亚和火基项目。在这个项目中,我们希望使用推送通知。但我们的问题是: 我们正在寻找一个推送通知插件,比如WhatsApp应用程序。例如,当我们向某人发送消息时,我们希望通知发送给我们发短信的人,而不是所有人。但是我们找不到一个自由的方法来做这件事。你有什么建议吗?谢谢。使用cordova插件和ionic native的Firebase云消息传递: 我不建议你使用FCM插件。它没有管理应用程序中通知的方法(清除全部或某些特殊通知) 最好使用一个或一个信号 impor
我们正在寻找一个推送通知插件,比如WhatsApp应用程序。例如,当我们向某人发送消息时,我们希望通知发送给我们发短信的人,而不是所有人。但是我们找不到一个自由的方法来做这件事。你有什么建议吗?谢谢。使用cordova插件和ionic native的Firebase云消息传递:
我不建议你使用FCM插件。它没有管理应用程序中通知的方法(清除全部或某些特殊通知) 最好使用一个或一个信号
import { FCM } from '@ionic-native/fcm/ngx';
constructor(private fcm: FCM) {}
this.fcm.getToken().then(token => {
//you can store device token in firebase, later you can target push notification from firebase console this token id
backend.registerToken(token);
});
this.fcm.onNotification().subscribe(data => {
if(data.wasTapped){ / * true , means the user tapped the notification from the notification tray and that’s how he opened the app. */
console.log("Received in background");
} else {// false , means that the app was in the foreground (meaning the user was inside the app at that moment)
console.log("Received in foreground");
};
});
this.fcm.onTokenRefresh().subscribe(token => {
//update device token
backend.registerToken(token);
});