Page 1 of 2

read android push notification payload

Posted: Sun Sep 22, 2013 12:14 am
by steve5588065

In my app I use in pushnotification event ....

var data = arguments[0].originalEvent.notification;

var msg = data.aps.alert;
var myid = data.smsid;

This works fine for iOS, sending smsid as a customitem, but on android the data.aps.alert; works fine, but the data.smsid returns undefined

smsid is sent as part of gcm payload
"data": {
"smsid": "6",
"alert": "Reminder of your Booking on Sat at 10AM"
}

what am I missing with android ??

regards
Steve


read android push notification payload

Posted: Sun Sep 22, 2013 4:12 am
by Illya Stepanov

Hello Steve -- what device and Android version are you using? We will test it on a device.


read android push notification payload

Posted: Sun Sep 22, 2013 5:15 am
by steve5588065

Hi Illya

I am using a Samsung galaxy Express Phone with android 4.1.2
but its the same on my Samsung galaxy Tab 2 Tablet with android 4.0.3


read android push notification payload

Posted: Mon Sep 23, 2013 9:12 pm
by Alena Prykhodko

Hi Steve!

Try to find this value for Android, check all data structure that you recieve. Add on page Textarea component and run for it the following:
preAppery( "mobiletextarea_name" ).val( JSON.stringify( data ) );/pre


read android push notification payload

Posted: Tue Sep 24, 2013 12:18 am
by steve5588065

Hi Alena

Here is the results of my test as requested
Android
Sent.....

{
"registration_ids": [
"APA91bEIq8sX7_918RQhCIQsbZFG2fAIUDZ8sh6tUFGIUBH4rI4Evqn8Eo9Ez6nXbd-bFuJQJHjmxoyFkOlX-8G0dnwFayYGHXmMHCWCddoiAdqA9hLpabZ4zLzLAFwSwiqn2idk0H1CgL-lutelueB6dT_Ft8K5Ug"
],
"data": {
"smsid": "5",
"alert": "reminder of your appt on 8/7/2013 at 10AM"
}
}

Received in App in TextArea component .......
{"aps":{"alert":"reminder of your apt on 8/7/2013 at 10AM"}}

iOS
Sent.....
{"aps":{"alert":"reminder of your appt on 8/7/2013 at 10AM","badge":1,"sound":"default"},"smsid":"5"}

Received in App in TextArea component .......
{"applicationStateActive":"1", "smsid":"5","applicationLaunchNotification":"0", "aps"
:{"badge":"1","sound":"default","alert":"reminder of your apt on 8/7/2013 at 10AM"}}

As you can see, for Android the smsid key-value pair is not being returned

I am using PushSharp .net assembly to send the Push Notifications

regards
Steve


read android push notification payload

Posted: Tue Sep 24, 2013 11:36 am
by Maryna Brodina

Hello! The problem seems to be in PhoneGap plugin PushNotifications. On Source tab or in Eclipse check src\com\phonegap\plugins\pushnotifications\PushNotifications.java and pay attention on onMessageReceived. You can find another plugin or rewrite existing one to recieve all data, not just an alert.


read android push notification payload

Posted: Wed Sep 25, 2013 12:26 am
by steve5588065

Hi marina

I wouldn't know where to start

Something like this is above my skill level

regards
Steve


read android push notification payload

Posted: Wed Sep 25, 2013 9:25 pm
by Kateryna Grynko

Hi Steve,

The Push Notifications mechanism will be changed in the nearest release. Maybe the easiest solution is just to wait for a new Push Notifications feature.


read android push notification payload

Posted: Wed Sep 25, 2013 10:06 pm
by steve5588065

Hi Katya

I will do that

Will the update have the android push notification features I am looking for?

regards
Steve


read android push notification payload

Posted: Thu Sep 26, 2013 2:11 pm
by Maryna Brodina

Hello! Sorry, not sure about that. We'll check and let you know.