Hi.
I made a share button and when it’s touched it should show a popup but on my device Samsung Galaxy S4 when I press a button I got an error “Application has stop working.”.
Code:
local function sharelistener() if native.canShowPopup("social","share") then native.showPopup("social") end end share:addEventListener("tap",sharelistener)
build.settings
settings = { orientation = { default = "portrait", supported = {"portrait","portraitUpsideDown"}, }, android = { usesPermissions = { "android.permission.INTERNET", "com.android.vending.BILLING", "com.android.vending.CHECK\_LICENSE", }, isGame = true, }, plugins = { ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = {android = true} }, ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs" }, }, }
main.lua
local licensing = require("licensing") local composer = require("composer") licensing.init("google") local function licensinglistener(event) if not event.isVerified then native.requestExit() end end licensing.verify(licensinglistener) composer.gotoScene("menu","fade",500)
menu.lua
local composer = require("composer") local scene = composer.newScene() function scene:create() local scenegroup = self.view local background = display.newRect(display.contentCenterX,display.contentCenterY,display.contentWidth,display.contentHeight) local title = display.newImage("title.jpg") local play = display.newImage("play.png") local rate = display.newImage("rate.png") local share = display.newImage("share.png") local removeads = display.newImage("removeads.jpg") title.width = display.contentWidth / 1.25 title.height = display.contentHeight / 7 title.x = display.contentCenterX title.y = title.height play.width = display.contentWidth / 2 play.height = display.contentHeight / 9 play.x = display.contentCenterX play.y = title.height \* 2.5 rate.width = display.contentWidth / 2 rate.height = display.contentHeight / 9 rate.x = display.contentCenterX rate.y = title.height \* 3.5 share.width = display.contentWidth / 2 share.height = display.contentHeight / 9 share.x = display.contentCenterX share.y = title.height \* 4.5 removeads.width = display.contentWidth / 2 removeads.height = display.contentHeight / 9 removeads.x = display.contentCenterX removeads.y = title.height \* 6 local function playlistener() end play:addEventListener("tap",playlistener) local function ratelistener() end rate:addEventListener("tap",ratelistener) local function sharelistener() if native.canShowPopup("social","share") then native.showPopup("social") end end share:addEventListener("tap",sharelistener) local function removeadslistener() end removeads:addEventListener("tap",removeadslistener) background:toBack() title:toFront() play:toFront() rate:toFront() share:toFront() removeads:toFront() scenegroup:insert(background) scenegroup:insert(title) scenegroup:insert(play) scenegroup:insert(rate) scenegroup:insert(share) scenegroup:insert(removeads) end function scene:destroy() local scenegroup = self.view scenegroup:removeSelf() end scene:addEventListener("create",scene) scene:addEventListener("destroy",scene) return scene
settings.lua
application = { content = { width = 320, height = 480, fps = 60, scale = "letterbox", }, license = { google = { key = " ", }, }, }