Hi guys,
If I'm subscribed to 2 channels, any notification I send is received twice! If I'm subscribed to 3 channels I receive it 3 times ! (I haven't tried it, but I am presuming that if I'm subscribed to 4 channels, I will receive it 4 times and so on...)
I'm guessing that my notify is being sent back to me on every channel I'm subscribed to rather than just the one it was addressed to! I am sending a JSON payload of data not an alert. The data arrives correctly.
I have checked the Dashboard's Log and it is only showing up as being sent from my phone once and the 'sent' channel is correct (and there's just one channel)
Would I be configuring the notify incorrectly?
notifyCode:
sendPushMessage("player" + playingFriends[numberOfPlayingFriends], {payloadCode: 1, fbid: myPlayerData.fbid, acsid: myPlayerData.acsid, first_name: myPlayerData.first_name}, function(messageOutcome){ if (messageOutcome === "Positive"){ etc... . . . var pushCounter = 0; . . . sendPushMessage = function(channel, payload, myCallback){ Ti.Media.vibrate(); if (payload === "") { payload = "Hi all from "+ myPlayerData.first_name + "'s phone!"; } else { payload.sound = "default"; }; Cloud.PushNotifications.notify({ channel : channel, payload : payload, }, function(e){ if (e.success){ alert("Sent!\n" + ++pushCounter); myCallback("Positive"); } else { alert("Failed to send"); myCallback("Fail"); }; }) };
Receiver Code:
pushParser = function(pushEvent){ Ti.Media.vibrate(); myPushData = JSON.parse(pushEvent.payload); if(myPushData.payloadCode != undefined) { alert("JSONed\n"+myPushData.first_name); } else { alert(JSON.parse(pushEvent.payload).android.alert); }; };
Like I say, it sends just fine and it does indeed arrive... but once for each subscribed channel!
Push-Log Output:
Send at 2013-01-15 09:40:08 UTC Message Id 36cc5430-5bea-4f26-9897-db65bf50fb09 Send Status Success Message Status UNKNOWN Channel player75xxx575 Device Token ND1TOCxxxP8GL42 Device Type AndroidOther Part of the Push-Log's Output:
Sender Channel player75xxx575 Payload {"payloadCode":1,"fbid":"75xxx75","acsid":"player75xxx75","first_name":"Robin","sound":"default"}Main Log's Output:
Request Time 2013-01-15 09:40:07 UTC Request Name POST /v1/push_notification/notify.json Response Status 200 Parameters { "ti_analytics" => "{"id":"2283e444xxx8a19d50","mid":"c0a95xxx977","aguid":"950c2cf1xxx0b3a13c8","event":"cloud.push_notification.notify","deploytype":"development","sid":"acfc547xxx2c54a6"}", "payload" => "{"payloadCode":1,"fbid":"75xxx575","acsid":"player75xxx575","first_name":"Robin","sound":"default"}", "channel" => "player75xxx575", "suppress_response_codes" => "true", "oauth_consumer_key" => "HXfyr8GrxxxFvEkXL", "_session_id" => "soTsKFxxxbxfwOI", "controller" => "push_notification", "action" => "notify", "version" => "v1", "format" => "json" } Authorization OAuth realm="",oauth_version="1.0",oauth_consumer_key="HXfyr8xxxFvEkXL",oauth_signature_method="HMAC-SHA1",oauth_nonce="LrVFxxxWzHt",oauth_timestamp="1358242805",oauth_signature="9K6KmxxxPL%2FOjs%3D" Source IP 194.106.52.175 Response Size 82 bytes Run Time 70 ms
(Running on an Android, XPeria Arc S LT18i, using Titanium Studio, build: 3.0.1.201212181159, Build: jenkins-titanium-rcp-master-350 (origin/master), Date: 18 December 2012, 12:04:42)