I am having some problems implementing iOS notifications. I previously asked in this thread:
http://forums.coronalabs.com/topic/38488-iosandroid-push-notifications/?hl=%2Bios+%2Bnotifications
about what services I could use. I followed the parse tutorial and have also tried with pushwoosh. My app is registering successfully with both services, I can see that on each services dashboard. But when I try to send a push notification I am not receiving anything on my devices, iPhone or iPad.
Here is the notification listener I have at the moment for using pushwoosh service.
local function onNotification( event ) if event.type == "remoteRegistration" then native.showAlert( "remoteRegistration", event.token, { "OK" } ) local DeviceID = event.token local PW\_APPLICATION = "appid" --use your app id in pushwoosh local PW\_URL = "https://cp.pushwoosh.com/json/1.3/registerDevice" local function networkListener( event ) if ( event.isError ) then --error occurred notify user native.showAlert( "Notification Registration Failed", "An Error Contacting the Server has Occurred. Please try again later from the application settings.", { "OK" } ) else --Registration worked perform any action you like here end end local commands\_json = { ["request"] = { ["application"] = PW\_APPLICATION, ["push\_token"] = DeviceID, ["language"] = system.getPreference("ui", "language"), ["hwid"] = system.getInfo("deviceID"), ["timezone"] = 3600, -- offset in seconds ["device\_type"] = 1 } } local jsonvar = {} jsonvar = json.encode(commands\_json) local post = jsonvar local headers = {} headers["Content-Type"] = "application/json" headers["Accept-Language"] = "en-US" local params = {} params.headers = headers params.body = post network.request ( PW\_URL, "POST", networkListener, params ) elseif event.type == "remote" then native.showAlert( "remote", json.encode( event ), { "OK" } ) end end
This is straight from the tutorial, am I missing something, this notification listener is very similar to what I used for Android notifications and I had no problems getting that to work.
Gooner87