Hi all,
First of all, I couldn’t find a section in “3rd party tools” for PooshWoosh… Pleeeeze (mods), don’t put this thread in 3rd party tools/other. No one ever looks in there.
Right, today, I thought I’d try the push woosh integration into iOS. I’ve spent all day, repeating the various processes and I just can’t get it to work. I mean, it does nothing. Nada.
I’ll just list the steps I went through. If anyone can see something glaringly obvious, that I’ve missed or messed up, let me know. I made a promise to my Client that this would be an easy process. There’s a distinct possibility, that I could end up looking stoopid!
This is what I did.
1/ iOS Dev center: Configured my app ID for push
2/ Downloaded the SSL. Installed into keychain (has green tick and is associated with key)
Note* This is a development app and pushes are in sandbox.
3/ Created the main development cert (associated with correct app ID)
4/ Created development provisioning profile using dev cert from step 3
5/ Installed provisoning profile into X-Code (is valid)
6/ Opened and set up app on PushWoosh
7/ Imported ssl cert and previously exported private key into Poosh Woosh
8/ Got app ID from pushwoosh
9/ Included the following code into my config
notification = { iphone = { types = { "badge", "sound", "alert" } } }
10/ Included this code into my main.lua --(this is Corona’s code example, NOT pushWoosh (some slight differences, although I have tried them both)
local json = require "json" local function notificationListener( event ) if ( event.type == "remote" or event.type == "local" ) then --handle the push or local notification elseif ( event.type == "remoteRegistration" ) then local deviceToken = event.token local deviceType = 1 --default to iOS if ( system.getInfo("platformName") == "Android" ) then deviceType = 3 end print( "Setting up with PushWoosh" ) local DeviceID = event.token local PW\_APPLICATION = "XXXXX-EE7C8" --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 native.showAlert( "Notification Registration Failed", "An Error Contacting the Server has Occurred.", { "OK" } ) else --registration successful! print( "PushWoosh registration successful", system.getInfo("deviceID") ) end end local commands\_json = { ["request"] = { ["application"] = PW\_APPLICATION, ["device\_id"] = DeviceID, ["language"] = "en", --OR: system.getPreference( "ui", "language" ), ["hw\_id"] = system.getInfo("deviceID"), ["timezone"] = -3600, --offset in seconds ["device\_type"] = deviceType } } local post\_body = json.encode( commands\_json ) local headers = {} headers["Content-Type"] = "application/json" headers["Accept-Language"] = "en-US" local params = {} params.headers = headers params.body = post\_body network.request ( PW\_URL, "POST", networkListener, params ) end end Runtime:addEventListener( "notification", notificationListener )
11/ Built my app using provisioning profile (no issues)
12/ compressed to IPA, uploaded to testFlight, installed on device, sent push note from PooshWoosh.
13/ Nothing!!! Not even an angry alert.
Can somebody, please, let me know if I’ve missed something obvious, point me in the direction of some working code or at least a walkthrough that’s more idiot-friendly, than these:
http://docs.coronalabs.com/guide/events/appNotification/index.html
…Driving me insane