Open bhumin3i opened 6 years ago
@macdonst any update?
@bhumin3i I'd have to see some logs from Android when the app is in the background. Run adb logcat | grep Push
while reproducing the problem.
For iOS I'd run the app in Xcode to see what the Xcode logs are.
@macdonst Android log :
08-22 12:12:05.336 6651 7358 D Push_FCMService: onMessage - from: xxxxxxxxx
08-22 12:12:05.336 6651 7358 D Push_FCMService: sender id = xxxxxxxxxx
08-22 14:43:01.394 6651 12651 D Push_FCMService: normalize extras
08-22 14:43:01.394 6651 12651 D Push_FCMService: key = organizer
08-22 14:43:01.394 6651 12651 D Push_FCMService: replace key organizer with organizer
08-22 14:43:01.394 6651 12651 D Push_FCMService: key = meetingName
08-22 14:43:01.395 6651 12651 D Push_FCMService: replace key meetingName with meetingName
08-22 14:43:01.395 6651 12651 D Push_FCMService: key = meetingRoom
08-22 14:43:01.395 6651 12651 D Push_FCMService: replace key meetingRoom with meetingRoom
08-22 14:43:01.395 6651 12651 D Push_FCMService: key = style
08-22 14:43:01.395 6651 12651 D Push_FCMService: replace key style with style
08-22 14:43:01.395 6651 12651 D Push_FCMService: key = title
08-22 14:43:01.395 6651 12651 D Push_FCMService: replace key title with title
08-22 14:43:01.396 6651 12651 D Push_FCMService: no locale found for key = title, error Value New of type java.lang.String cannot be converted to JSONObject
08-22 14:43:01.396 6651 12651 D Push_FCMService: key = enddateTime
08-22 14:43:01.396 6651 12651 D Push_FCMService: replace key enddateTime with enddateTime
08-22 14:43:01.396 6651 12651 D Push_FCMService: key = message
08-22 14:43:01.396 6651 12651 D Push_FCMService: replace key message with message
08-22 14:43:01.397 6651 12651 D Push_FCMService: no locale found for key = message, error Value heloooooooo of type java.lang.String cannot be converted to JSONObject
08-22 14:43:01.397 6651 12651 D Push_FCMService: key = startdateTime
08-22 14:43:01.397 6651 12651 D Push_FCMService: replace key startdateTime with startdateTime
08-22 14:43:01.401 6651 12651 D Push_FCMService: foreground
08-22 14:43:01.401 6651 12651 D Push_Plugin: convert extras to json
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = organizer
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = meetingName
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = meetingRoom
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = style
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = title
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = enddateTime
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = message
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = coldstart
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = startdateTime
08-22 14:43:01.401 6651 12651 D Push_Plugin: key = foreground
08-22 14:43:01.402 6651 12651 V Push_Plugin: extrasToJSON: {"title":"New Notification","message":"heloooooooo","additionalData":{"organizer":"","meetingName":"","meetingRoom":"","style":"inbox","enddateTime":"","coldstart":false,"startdateTime":"","foreground":true}}
iOS : nothing show in log.
also in iOS not able to see any log while send notification from server.
pushObject.on('notification').subscribe((notification: any) => {
console.log('notification recive',JSON.stringify(notification));
});
in background I'm able to see notification but when app is in foreground nothing to see in application.
I am having a similar problem.
If I use the 'aps' key like it says in the documentation I do not get the notification on IOS.
If I use the 'notification' key I get the notification on IOS and my on('notification') callbacks get called in IOS.
but If I have the 'notification' key in the message, my on('notification') callbacks won't get called on Android.
Works: {to: 'key', 'data':{}, 'notification':{}} Does not work {to:'key', 'data':{}, 'aps':{}}
Please make this work like the documentation says it should.
@Schwoebel Thanks for your reply but I'm using azure notification hub, now it is working on android but when I'm in forground in iOS it doesn't works but when my app is in background I receive the notification. my payload is
var anroidTemplate = {
"data": {
"style": 'inbox',
"title": "(title)",
"message": "message",
"meetingName": "(meetingname)",
"meetingRoom": "(meetingroom)",
"organizer": "(orgaizername)",
"startdateTime": "(startdateTime)",
"enddateTime": "(enddateTime)"
}
};
var iostemplate = {
"aps": {
"alert": "(message)",
"title": "(title)",
"message": "(message)",
"meetingName": "(meetingname)",
"meetingRoom": "(meetingroom)",
"organizer": "(orgaizername)",
"startdateTime": "(startdateTime)",
"enddateTime": "(enddateTime)"
}
};
@macdonst any update bro?
pushObject.on('notification').subscribe((notification: any) => {
console.log('notification recive',JSON.stringify(notification)); //not working in iOS
});
@bhumin3i I don't think IOS Is going to work with "aps" as your key.
try "notification".
I also learned, and this isn't documented either, that you can 't send one push that covers both types of devices. "aps" doesn't work on ios. "notification" does, BUT if you send a message with a "notification" key and ANdroid app won't fire the "on('notification')" call back.
@Schwoebel thanks but i refer azure template and it mention registration is as follows
{"aps": {"alert": "$(message)"}}
https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-templates-cross-platform-push-messages
@Schwoebel when i change key "aps" to "notification" there is nothing in ios device. even that scenario background notification is also not working. please help me.
@macdonst can you please help me on this as soon as possible?
@Schwoebel This is actually documented [1][2], but I reckon our payload documentation has grown too complex to be readable or used as an argument, so I ask users (like you) to please help us improve it. The notification vs data (android vs ios) issue is now the most reported and misunderstood one on this plugin, and we need to focus on making it crystal clear on the docs to prevent future confusion:
[1]: https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#fcm-and-additional-data [2]: https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#notification-vs-data-payloads
I forgot to mention in my project I am used another plugin which have notification functionality may be it helps you to find out.
@bhumin3i on Android you showed me an example of the push coming in when the app is in the foreground which is the scenario you don't have a problem with. Can you put the app in the background and send a push message?
What does your init method look like on iOS? Are you registering for APNS or FCM based notifications.
@macdonst thanks for reply, use APNS for sending notification it show up on background but not foreground and doesn't trigger on('notification') event when app in background and foreground.
pushObject.on('notification').subscribe((notification: any) => {});
my code look like :
const options: PushOptions = {
android: {
senderID: this._globalVar.pushSenderID
},
ios: {
alert: "true",
badge: true,
sound: "false",
clearBadge: 'true'
},
windows: {}
};
this._pushObject = this._push.init(options);
hey @macdonst please help me
@bhumin3i you aren't giving me enough information in order to be able to help you. I still don't see logs from you when the Android app is in the background. I am very surprise that the on('notification')
method is not being called if you are seeing the message on iOS. There should be something in the Xcode logs.
@macdonst nothings seems in Xcode log
@macdonst I have used below plugins in my project. Please please help me, my project is going to in UAT.
com.googlemaps.ios 2.7.0 "Google Maps SDK for iOS"
cordova-background-geolocation-lt 2.13.0 "BackgroundGeolocation"
cordova-open-native-settings 1.5.1 "Native settings"
cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
cordova-plugin-badge 0.8.7 "Badge"
cordova-plugin-cocoalumberjack 0.0.4 "CocoaLumberjack"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-email-composer 0.8.15 "EmailComposer"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.4.1 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-ms-adal 0.10.1 "ADAL for Cordova"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 2.4.0 "Cordova sqlite storage plugin"
es6-promise-plugin 4.1.0 "Promise"
mx.ferreyra.callnumber 0.0.2 "Cordova Call Number Plugin"
phonegap-plugin-barcodescanner 8.0.0 "BarcodeScanner"
phonegap-plugin-push 2.2.3 "PushPlugin"
sentry-cordova 0.12.2 "Sentry"
wifiwizard2 2.1.0 "WifiWizard2"
@macdonst can you help me ASAP cause only this bug is show stopper for release application. If you are available on slack or Skype please send me your id on Bhumin.bhandari@3i-infotech.com it would be helpfull for me to share my code with you. Thanks. Note : Android works fine but Ios doesn’t.
@macdonst thanks for reply, use APNS for sending notification it show up on background but not foreground and doesn't trigger on('notification') event when app in background and foreground.
pushObject.on('notification').subscribe((notification: any) => {});
my code look like :
const options: PushOptions = { android: { senderID: this._globalVar.pushSenderID }, ios: { alert: "true", badge: true, sound: "false", clearBadge: 'true' }, windows: {} }; this._pushObject = this._push.init(options);
I am facing same issue, could not figure it out. Can you please guide us. I receive Push when app in background, but when app in foreground I dont receive push in push.on('notification'), this is causing problem
@pankajzanzanefidel you are facing on both device or only ios device? android works fine for me but ios still going to not work :(
Yes same here, on ios it is not working , pain stackingly difficult to same my ass from client now. You were my last hope
On Thu, Oct 4, 2018, 11:03 AM Bhumin notifications@github.com wrote:
@pankajzanzanefidel https://github.com/pankajzanzanefidel you are facing on both device or only ios device? android works fine for me but ios still going to not work :(
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/phonegap/phonegap-plugin-push/issues/2527#issuecomment-426890729, or mute the thread https://github.com/notifications/unsubscribe-auth/Ah6cbCqMMWMxYotD6130SMvFSfss32GFks5uhZ3FgaJpZM4WBSmw .
@pankajzanzanefidel sorry bro, can't help you still i'm facing same. but if i got something sure i let you know first.
@pankajzanzanefidel i don't know why @macdonst is not helping us. :(
@pankajzanzanefidel any luck?
Something to report: With plugin v2.1.3 in iOS, on 'notification' did not fire app was in foreground (i'm sending through AWS SNS =>APNS). Adding "content-available": 1 fixes that problem, and on 'notification' fires, however it also fires in the notifications tray at the same time as if app is running in background. Will try newer version of plugin if I can get it installed.
"alert":template_text, "sound":'default', "badge":1, "notId":aid, "content-available": 1
Thanks @tpneumat for helping let me try again with latest version and for your information earlier I tried with latest version but got same
Expected Behaviour
We should able to view notification in notification panel(when app is not active) or as a dialogue(when app is in foreground)
Actual Behaviour
Case 1 (Android) : Unable to view notification in notification panel but when app is in foreground we can see notification . Case 2 (iOS) : When receiving notification it shows in notification panel but can's see it as dialogue when app is in foreground.
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
(Android) What device vendor (e.g. Samsung, HTC, Sony...)
SAMSUNG , IPHONE7
Cordova CLI version and cordova platform version
Plugin version
Sample Push Data Payload
Sample Code that illustrates the problem
Logs taken while reproducing problem
LOG show in android while push send from server but nothing show in iOS