I have a weather app for the netherlands with push notification for weather warnings. It works good, but i receive the push notification more then 24 hour later then it was send. I have 7000+ users for push notification. The first 2 day's i received them on time, but now with big delay. i guess that the push notifications are send in batches. How can i prevent this delay????? I use the push notification of Appcelerator....
3 Answers
the php-code i use to create a push notification:
$json = ' { "sound": "default", "alert" : "'.$arrWarning[0].'" } '; $tmp_fname = "cookie.txt"; $Curl_Session1 = curl_init('https://api.cloud.appcelerator.com/v1/users/login.json?key=<myProdAppKey>'); curl_setopt ($Curl_Session1, CURLOPT_COOKIEJAR, $tmp_fname); curl_setopt ($Curl_Session1, CURLOPT_RETURNTRANSFER, true); curl_setopt ($Curl_Session1, CURLOPT_COOKIEFILE, $tmp_fname); curl_setopt ($Curl_Session1, CURLOPT_POST, 1); curl_setopt ($Curl_Session1, CURLOPT_POSTFIELDS, "login=***@***.***&password=******"); curl_setopt ($Curl_Session1, CURLOPT_FOLLOWLOCATION, 1); $res = curl_exec ($Curl_Session1); echo $res."<br />"; curl_close ($Curl_Session1); $session = json_decode($res); $Curl_Session2 = curl_init('https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=<myProdAppKey>'); curl_setopt($Curl_Session2, CURLOPT_COOKIEFILE, $tmp_fname); curl_setopt($Curl_Session2, CURLOPT_COOKIEJAR, $tmp_fname); curl_setopt ($Curl_Session2, CURLOPT_POST, 1); curl_setopt ($Curl_Session2, CURLOPT_POSTFIELDS, "channel=alerts&payload=".$json); curl_setopt ($Curl_Session2, CURLOPT_FOLLOWLOCATION, 1); $res2 = curl_exec ($Curl_Session2); curl_close ($Curl_Session2); echo $res2."<br />";$arrWarning[0] = data from database, first part of the string
Duration of the script: less then 1/10 of a second.
If i also include the developer part, my developer-device receives the alert in a few seconds (2 or 3 seconds)
So is it an Appcelerator problem or a problem at Apple? Who can help?
They are Not batched but queued and Apple say they do Not guarantee immediat delivery but 24 hours Sounds Bad especially in your type of app. Probably the ACS Servers are currently slow? I am afraid you cant do that much. but before blaming others you should make Sure yourbackend works well.
Can you please email me your app key to wkong@appceleraator.com? We can check if ACS server has a delay. Are you still seeing this delay? Normally, if there is a delay on the ACS side, then your test push message to the Apple sandbox would be delayed too.
Your Answer
Think you can help? Login to answer this question!