我在从服务器端发送的消息中有click_Action:'FCM_PLUGIN_ACTIVITY‘,但onNotification()方法在安卓系统上没有执行。我在设备上收到了推送通知,但它不能进入onNotification()。它在ios上工作得很好。
下面是我的应用程序中的cordova版本。
"dependencies": {
"cordova-android": "^6.2.3",
"cordova-google-api-version": "0.0.1",
"cordova-ios": "^4.5.0",
"cordova-plugin-fcm": "git+https://github.com/ostownsville/cordova-plugin-fcm.git",
"cordova-plugin-geolocation": "2.1.0",
"cordova-plugin-inappbrowser": "1.2.0",
"cordova-plugin-network-information": "1.2.1",
"cordova-plugin-screen-orientation": "~2.0.2",
"cordova-plugin-splashscreen": "3.2.2",
"cordova-plugin-streaming-media": "^1.0.2",
"cordova-plugin-whitelist": "1"
}我已经尝试了所有可能的解决方案来解决它。有人能帮我一下吗。
发布于 2018-01-16 23:45:18
我遇到了完全相同的问题,无论我做什么,onNotification()都不会触发。我最终使用了使用cordova's push plugin的ionic native push,它工作得很完美。下面是我所做的const options: PushOptions = { android: { senderID: '??????' }, ios: { alert: 'true', badge: false, sound: 'true' } }; const pushObject: PushObject = this.push.init(options); pushObject.on('registration').subscribe((data: any) => { console.log('device token -> ' + data.registrationId); });的一小段
`pushObject.on('notification').subscribe((data: any) => { console.log('message -> ' + data.message); }); pushObject.on('error').subscribe(error => console.error('Error with Push plugin' + error));`https://stackoverflow.com/questions/48020350
复制相似问题