steve5588065
Posts: 0
Joined: Tue Feb 26, 2013 6:36 am

read android push notification payload

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

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

read android push notification payload

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

steve5588065
Posts: 0
Joined: Tue Feb 26, 2013 6:36 am

read android push notification payload

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

read android push notification payload

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

steve5588065
Posts: 0
Joined: Tue Feb 26, 2013 6:36 am

read android push notification payload

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

read android push notification payload

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.

steve5588065
Posts: 0
Joined: Tue Feb 26, 2013 6:36 am

read android push notification payload

Hi marina

I wouldn't know where to start

Something like this is above my skill level

regards
Steve

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

read android push notification payload

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.

steve5588065
Posts: 0
Joined: Tue Feb 26, 2013 6:36 am

read android push notification payload

Hi Katya

I will do that

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

regards
Steve

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

read android push notification payload

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

Return to “Issues”