i don’t have any trubles with it in Android but with IOS it’s a nightmare, just doesn’t work.
Here is What i do:
In my main.lua i put:
local function onNotification( event ) if event.type == "remoteRegistration" then local PushToken = event.token local PW\_APPLICATION = "4C9E0-1768A" --// use your app id in pushwoosh local PW\_URL = "https://cp.pushwoosh.com/json/1.3/registerDevice" local deviceType = 1 --// default to iOS if ( system.getInfo("platformName") == "Android" ) then deviceType = 3 end 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"] = PushToken, ["language"] = system.getPreference("ui", "language"), ["hwid"] = system.getInfo("deviceID"), ["timezone"] = 3600, --// offset in seconds ["device\_type"] = deviceType } } 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 ) end end -- The notification Runtime listener should be handled from within "main.lua" Runtime:addEventListener( "notification", onNotification )
2.
in my config.lua it looks like this:
application = { showRuntimeErrors = false, content = { width = 720, height = 1280, scale = "zoomStretch" }, notification = { iphone = { types = { "badge", "sound", "alert" } }, google = { projectNumber = "601322321360" }, }, }
then i go to Keychain Access and do CertificateAssistant>Request A Certificate From a Certificate Authority>
put my detailes and save the file on my mac as defaultCert.certSigningRequest,
then i go to my ID on Apple Developer site, and add Pushwosh Cert > Development > (upload the certSigningRequest> then create a push Cert and Download it to Mac
I do the same for Production
then i dubble click the Production Cert, and the Development Cert i downloaded that uploades them to keychain,
i go To Keychain then i right click once on Apple Development IOS Push Services:(id) > export P12 file > give password and save the file as P12Development.p12
i go To Keychain then i right click once on Apple Production IOS Push Services:(id) > export P12 file > give password and save the file as P12Production.p12
then i go to Pushwosh, and upload the P12Development.p12 file and the the downloaded development Cert i downloaded from Apple Developer.
then i build using a Provisional Profile For Testings Assosieted with That ID ,
11.
upload application on Phone
and that’s it, the device doesn’t Register at push wosh !!! nor does it shows in the notifications in the settings,
i tried that multiple times and NONE seems to work or make it show in the notifications… please can you help me anyone ?
Corona build 2646 (2015.2.27)
[Update]
managed to make it show up in notifications by adding
local notifications = require( "plugin.notifications" ) notifications.registerForPushNotifications()
and the actualy plugin in build.settings,
but it still doesn’t show up in pushwosh devices…