プッシュ通知付きのアンドロイドアプリケーションを作成しようとしましたが、通知を受け取ったときに特定のコンポーネントを開きたいとします。私app.component.tsコンストラクタでIonic v2:特定のページを開くようにプッシュ通知
https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md
http://docs.ionic.io/services/push/
私はこれを試してみてください。
platform.ready().then(() => {
//StatusBar.styleDefault();
Splashscreen.hide();
this.push.rx.notification()
.subscribe((msg) => {
alert(msg.title + ': ' + msg.text);
console.log(msg.app, "app");
console.log(msg.count, "count");
console.log(msg.image, "image");
console.log(msg.raw, "raw");
console.log(msg.sound, "sound");
console.log(msg.text, "text");
console.log(msg.title, "title");
});
});
私のアプリが近いか一時停止にない場合にはうまく機能します。私は自分のログを見ることができます。 しかし、私のアプリが閉じられたり、一時停止されたりすると、通知をタッチすると、私のアプリは開いていますが、私は自分のログを持つことができません。
私もこれを試してみました:
this.push.on('notification', function(data) {
// do something with the push data
// then call finish to let the OS know we are done
this.push.finish(function() {
console.log("processing of push data is finished");
}, function() {
console.log("something went wrong with push.finish for ID = " + data.additionalData.notId)
}, data.additionalData.notId);
});
をしかし、私は、このエラーが発生しました:
Object [object Object] has no method 'on'
私がしなければなりませんか?
私はfirebaseでそれをシミュレートできませんか? https://console.firebase.google.com/ –
HTTPプロトコルを使用して直接メッセージを送信することができます。[https://firebase.google.com/docs/cloud-messaging/send-message](documentatiion) – Djiggy