0

I am trying to implement OneSignal Corna SDK for receiving PUSH NOTIFICATIONS, But it is giving me a runtime error

stack traceback: /Users/ojussave/Library/Application Support/Corona/Simulator/Plugins/plugin_OneSignal.lua:49: in function 'Init' main.lua:52: in main chunk

ojus
  • 128
  • 5
  • [Link](https://documentation.onesignal.com/docs/corona-sdk) to documentation and forum [OneSignal](https://forums.coronalabs.com/forum/640-onesignal/) . – ldurniat Mar 06 '17 at 22:54

1 Answers1

0

This error means that there was likely a syntax error in your code. Make sure you have formatted the call to the OneSignal init method correctly, like so:

-- This function gets called when the user opens a notification or one is received when the app is open and active.
-- Change the code below to fit your apps needs.
function DidReceiveRemoteNotification(message, additionalData, isActive)
  if (additionalData) then
    if (additionalData.discount) then
        native.showAlert( "Discount!", message, { "OK" } )
        -- Take user to your app store
    elseif (additionalData.actionSelected) then -- Interactive notification button pressed
        native.showAlert("Button Pressed!", "ButtonID:" .. additionalData.actionSelected, { "OK"} )
    end
  else
    native.showAlert("OneSignal Message", message, { "OK" } )
  end
end

local OneSignal = require("plugin.OneSignal")
-- Uncomment SetLogLevel to debug issues.
-- OneSignal.SetLogLevel(4, 4)
OneSignal.Init("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "############", DidReceiveRemoteNotification)
Gdeglin
  • 12,432
  • 5
  • 49
  • 65