When using the GameThrive plugin I keep getting the following Runtime Error.
[lua]Runtime error
?:0: attempt to index global ‘context’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘findPluginToDownloadFromServerCatalog’
?: in function ‘handleManifestDownload’
?: in function
Runtime error: ?:0: attempt to index global ‘context’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘findPluginToDownloadFromServerCatalog’
?: in function ‘handleManifestDownload’
?: in function
[/lua]
anyone know what the cause of this could be, using the demo code provided and same issue.
Here is my file setup’s
Build.settings
[lua]-- ----------------------------------------------------------------------------------
– FILENAME: build.settings
– DATE: 11/03/2014
– MODIFIED: V1.0.0
– COPYRIGHT: Danny Roerring
– WEBSITE: www.roedangames.net
– GAME:
settings =
{
plugins =
{
[“plugin.GameThrivePushNotifications”] =
{
– required
publisherId = “com.gamethrive”,
},
},
androidPermissions =
{
“android.permission.ACCESS_NETWORK_STATE”,
“android.permission.READ_PHONE_STATE”,
“android.permission.INTERNET”
},
orientation =
{
default =“landscapeRight”,
content = “landscapeRight”,
supported =
{
“landscapeRight”
},
},
iphone =
{
plist =
{
UIPrerenderedIcon = true,
UIStatusBarHidden = true
},
},
}[/lua]
Config.Lua
[lua]-- ----------------------------------------------------------------------------------
– FILENAME: config.lua
– DATE: 11/03/2014
– MODIFIED: V1.0.0
– COPYRIGHT: Danny Roerring
– WEBSITE: www.roedangames.net
– GAME:
–calculate the aspect ratio of the device:
local aspectRatio = display.pixelHeight / display.pixelWidth
application = {
content = {
width = aspectRatio > 1.5 and 320 or math.ceil( 480 / aspectRatio ),
height = aspectRatio < 1.5 and 480 or math.ceil( 320 * aspectRatio ),
scale = “letterBox”,
fps = 30,
imageSuffix = {
["@2x"] = 1.5,
["@4x"] = 3.0,
},
},
– Push notifications
notification = {
–google = { projectNumber = “xxxxxxxxxxxxxx” },
iphone = { types = { “badge”, “sound”, “alert” } },
},
}
[/lua]
Main.lua
[lua]-- ----------------------------------------------------------------------------------
– FILENAME: main.lua
– DATE: 11/03/2013
– MODIFIED: V1.0.0
– COPYRIGHT: Danny Roerring
– WEBSITE: www.roedangames.net
– GAME:
– is a game where you have to kill bugs
– IMPORT and REQUIRES
– include the Corona “storyboard” module
local storyboard = require “storyboard”
– VARIABLES
– SETTINGS
– CODE HERE
– 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, isFirstOpen)
if (additionalData and additionalData.discount) then
native.showAlert( “Discount!”, message, { “OK” } )
– Take player to your game store
elseif(additionalData and additionalData.bonusCredits) then
if (isFirstOpen) then
– Add credits here
end
native.showAlert( “Bonus Credits!”, message, { “OK” } )
– Take player your game store or inventory
end
end
local launchArgs = …
local GameThrive = require ( “plugin.GameThrivePushNotifications” )
GameThrive.HandleLaunchArgs(launchArgs, “xxxxxxxxxxxxxxxxx”, DidReceiveRemoteNotification)
– hide the status bar
display.setStatusBar( display.HiddenStatusBar )
– load menu screen
storyboard.gotoScene( “menuScene” )[/lua]
I added “xxxx” to the above to hide my App ID /Key