Closed theavijitsarkar closed 8 years ago
can you please tell us the version of play services that you are including with your cordova application
how to find that out?
Please update to the latest SDK version and let us know if you are still facing any issues..
We made some major changes to how we handle push notification. Please refer -> https://github.com/freshdesk/hotline-phonegap/blob/master/README.md
The problem is not solved. It is bypassed. My issue is that I use onesignal for notifications. Now I cant run both onesignal and push plugin together, I tried but the app now receives two copies for each message.
ok .. if you don't want to use the push plugin .. you can remove that ..
You just need to make sure Hotline.updateRegistrationToken
is called when you receive a push token
and
Hotline.handlePushNotification
is called when a push notification is received.
It should work fine.
@snowbreeze I have reopened this issue . Please check and let us know.
Ok let me try
I modified the OneSignal to pass the incoming data to hotline, However now no messages come from hotline the notificationReceived callback is never called. I tested it directly in that case it works.
var notificationReceived = function(data) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(data));
window.Hotline.isHotlinePushNotification(data.additionalData, function(success, isHotlineNotif) {
if (success && isHotlineNotif) {
window.Hotline.handlePush(data.additionalData);
}
});
};
window.plugins.OneSignal
.startInit("41952347-57d7-49b4-a520-aa5a1a969c42", "743540710589")
.handleNotificationReceived(notificationReceived)
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
window.plugins.OneSignal.getIds(function(ids) {
console.log('getIds: ' + JSON.stringify(ids));
//alert("userId = " + ids.userId + ", pushToken = " + ids.pushToken);
window.Hotline.updateRegistrationToken(ids.pushToken);
});
OUTPUT IS
didReceiveRemoteNotificationCallBack: {"isAppInFocus":false,"shown":true,"androidNotificationId":-XXXX,"payload":{"lockScreenVisibility":1,"rawPayload":"{\"google.sent_time\":XXX,\"notificationId\":-XXX,\"title\":\"Demo DEMO\",\"collapse_key\":\"do_not_collapse\",\"alert\":\"dedasd asdasd asd asd\",\"from\":\"XXXXXXXX\",\"google.message_id\":\"0:XXXX%XX\",\"custom\":\"{\\\"i\\\":\\\"XX-839b-4445-85c3-XX\\\"}\"}","body":"dedasd asdasd asd asd","title":"Demo DEMO","notificationID":"XX-839b-4445-85c3-XXX","fromProjectNumber":"XXXXXX"},"displayType":0}
Note: I dont see the additional in the json, will that only come if hotline sends it
Hey, are you trying to send mock notification payload? If so can you try integrating the project with the hotline dashboard and check if the notifications are working?
Please do reopen if the issue is not fixed.
When I activate notifcations android app fails completely.