Hey Chris,
I’ve been developing an app based on Coronium and everything has been so easy! Thanks heaps.
But today I hit a wall. I’m trying to figure out the push notifications and I can’t get my device to register. I’ve signed up with PushBots and saved the key and secret in the admin panel.
Here is my main.lua code
local composer = require( "composer" ) local scene = composer.newScene() local notifications = require( "plugin.notifications" ) notifications.registerForPushNotifications() local coronium = require( "mod\_coronium" ) coronium:init( { appId = "my.domain.com", apiKey = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } ) ..... if (launchArgs and launchArgs.notification) then end local function notificationListener( event ) ------- CLEAR BADGE NUMBER ON APPLE if device.isApple and badge ~= 0 then native.setProperty( "applicationIconBadgeNumber", 0 ) end ------- REGISTER DEVICE WITH PUSHBOTS if ( event.type == "remoteRegistration" ) then local answer = coronium.push.registerDevice( event.token, coronium.IOS ) if not answer.error then coronium.log( "Device registered" ) end ------- RECEIVE LOCAL NOTIFICATION elseif ( event.type == "local" ) then if (event.custom) then if (event.custom.msgTitle) then msgTitle = event.custom.msgTitle end end --handle the local notification native.showAlert( msgTitle, event.alert, { "OK" } ) ------- RECEIVE PUSH NOTIFICATION elseif ( event.type == "remote" ) then if (event.custom) then if (event.custom.msgTitle) then msgTitle = event.custom.msgTitle end end --handle the push notification native.showAlert( msgTitle, event.alert, { "OK" } ) end end Runtime:addEventListener( "notification", notificationListener )
I get to the “registerDevice” with a token, and then just nothing. No error, no output of any kind.
I tried to find the answers on Google and I found another thread where someone was using mod_push, but from what I can tell, that’s no longer maintained?
I’m using mod_coronium v1.92.5, my coronium server is 1.92 and I’m building with corona DB 2016.2850
Any ideas or suggestions? Or am I better off just waiting for Coronium 2?
Cheers,
Brad