I’m new to Corona so sorry if I’m missing something obvious. I have GameThrive set up and I’m receiving notifications properly on both Android and iOS; it was super easy to setup so kudos there.
For whatever reason I am unable to trigger a scene change on notification press. In this particular example I am sending Additional Data of {“COC”:""} to popup the notification (which is working to that point) and on pressing “learn more” I would like to transition the user to the COC scene, I just can’t seem to get that to happen.
I fear I am misunderstanding something scope related so any help is appreciated.
As a secondary question id also be interested in jumping a user to a specific scene without the notification if that is possible as well.
-- include Corona's "widget" library local widget = require "widget" local composer = require "composer" -- This function gets called when the player opens a notification or one is received when the app is open and active. function DidReceiveRemoteNotification(message, additionalData, isActive) print("DidReceiveRemoteNotification:Messsage: " .. message) if (additionalData) then if (additionalData.COC) then native.showAlert( "Challenge Of Champions", message, { "Dismiss","Learn More" },onNotificationComplete ) elseif(additionalData.actionSelected) then -- Interactive notification button pressed native.showAlert("Button Pressed!", "ButtonID:" .. additionalData.actionSelected, { "OK"} ) end end end local GameThrive = require("plugin.GameThrivePushNotifications") GameThrive.Init("XXXXXX", "XXXXXXX", DidReceiveRemoteNotification) -- show current scale factor in terminal local deviceWidth = ( display.contentWidth - (display.screenOriginX \* 2) ) / display.contentScaleX local scaleFactor = math.floor( deviceWidth / display.contentWidth ) print("scale : " .. scaleFactor .."x") -- show default status bar (iOS) display.setStatusBar( display.DefaultStatusBar ) -- set up screen options on scene fade local options = { effect = "fade", time = 100, params = {} } -- event listeners for tab buttons: local function onHome( event ) composer.gotoScene( "HomeScreen",options ) end local function onSchedule( event ) composer.gotoScene( "Schedule",options ) end local function onActivities( event ) composer.gotoScene( "Activities",options ) end local function onVote1( event ) composer.gotoScene( "Vote1",options ) end local function onCOC( event ) composer.gotoScene( "COC",options ) end local function onNotificationComplete( event ) if event.action == "clicked" then local i = event.index if i == 1 then -- Do nothing - user selected OK ; dialog will simply dismiss elseif i == 2 then -- User selected Learn more go to Something composer.gotoScene( "COC",options ) end end end -- create a tabBar widget with two buttons at the bottom of the screen -- table to setup buttons local tabButtons = { { label="Home", defaultFile="icon1.png", overFile="icon1-down.png", width = 32, height = 32, onPress=onHome, selected=true }, { label="Schedule", defaultFile="icon2.png", overFile="icon2-down.png", width = 32, height = 32, onPress=onSchedule }, { label="Activities", defaultFile="icon1.png", overFile="icon1-down.png", width = 32, height = 32, onPress=onActivities }, { label="COC", defaultFile="icon2.png", overFile="icon2-down.png", width = 32, height = 32, onPress=onCOC }, } -- create the actual tabBar widget local tabBar = widget.newTabBar{ top = display.contentHeight - 50, -- 50 is default height for tabBar widget buttons = tabButtons } onHome() -- invoke first tab button's onPress event manually