Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 在我们的爱奥尼亚4项目中有没有使用推送通知的方法?_Ionic Framework_Push Notification_Apple Push Notifications_Ionic4_Android Push Notification - Fatal编程技术网

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);
});