0
1

I'm not seeing the payload at all when I consume notifications using a Cordova app using the Pushwoosh plugin. When the application is open, this is what I get in the console when receiving a notification:

2014-04-29 11:35:13.977 MyApp[1024:800b] Sending request: {"request":{"hwid":"HWID","application":"APPID","v":"2.0","hash":"%"}}
2014-04-29 11:35:13.979 MyApp[1024:800b] To urL https://cp.pushwoosh.com/json/1.3/pushStat
2014-04-29 11:35:14.016 MyApp[1024:5b13] Sending request: {"request":{"hwid":"HWID","application":"APPID","badge":0,"v":"2.0"}}
2014-04-29 11:35:14.018 MyApp[1024:5b13] To urL https://cp.pushwoosh.com/json/1.3/setBadge
2014-04-29 11:35:14.051 MyApp[1024:6c0f] Sending request: {"request":{"hwid":"HWID","application":"APPID","badge":0,"v":"2.0"}}
2014-04-29 11:35:14.053 MyApp[1024:6c0f] To urL https://cp.pushwoosh.com/json/1.3/setBadge
2014-04-29 11:35:14.659 MyApp[1024:800b] Response "200 no error": string: {"status_code":200,"status_message":"OK","response":null}
2014-04-29 11:35:14.661 MyApp[1024:800b] sendStats completed
2014-04-29 11:35:14.664 MyApp[1024:6c0f] Response "200 no error": string: {"status_code":200,"status_message":"OK","response":null}
2014-04-29 11:35:14.666 MyApp[1024:6c0f] setBadges completed
2014-04-29 11:35:14.675 MyApp[1024:5b13] Response "200 no error": string: {"status_code":200,"status_message":"OK","response":null}
2014-04-29 11:35:14.677 MyApp[1024:5b13] setBadges completed

And my listener code:

document.addEventListener('push-notification', function(event) {
        notification = event.notification;
        navigator.notification.alert(JSON.stringify(event.notification.u));
        console.warn('--PAYLOAD:' + event.notification.u);
        pushNotification.setApplicationIconBadgeNumber(0);
    });

Shouldn't I be seeing the Custom Data event.notification.u in the console or in a notification when a notification is received and the app is open?

Also, is it possible to receive the payload when the app is closed & a iOS notification is clicked? I'd like to use the custom data for deep-linking in my app.

Thanks.

asked 29 Apr '14, 16:34
keston's gravatar image

keston
1113

How do you send your custom data? Is it JSON based? What is your username in the control panel?

When iOS notification is clicked your app starts and of course it could receive the payload of the notification.

permanent link
answered 30 Apr '14, 17:24
shader's gravatar image

shader
3.9k7

The custom data is JSON based- I'm just sending a couple of ids to use in the app {"g":1,"t":88} as an example.

My username is dpulavarthi.

(30 Apr '14, 17:27) keston keston's gravatar image
1

If you do stringify the whole payload what do you see? ex: navigator.notification.alert(JSON.stringify(event.notification));

(30 Apr '14, 17:31) shader shader's gravatar image

Not sure what happened, but once I backed up to outputting event.notification I started seeing the u array in the payload. it seems to be working properly now. Thanks for the quick response.

(01 May '14, 16:29) keston keston's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×352
×190
×165
×25

question asked: 29 Apr '14, 16:34

question was seen: 1,831 times

last updated: 01 May '14, 16:29