If you put a native.showAlert in the listener function for the urlRequest event callback, you’ll see the alert twice, then the app will crash. I’ve tried this with both simulator and on device.
The basic code I’m using is:
[lua]local allowedToAlert = false
local function listener( event )
if (allowedToAlert) then
native.showAlert( “Corona” , “ArticleGetFeed”, { “OK” } )
end
return true
end
local options = { hasBackground=true, baseUrl=system.ResourceDirectory, urlRequest=listener }
native.showWebPopup( “index.html”, options ) – local file
timer.performWithDelay(
1000,
function()
allowedToAlert = true
end,
1
)[/lua]
The timer is there to stop the initial page load from causing the alert to show.
Am I doing something really dumb?
Matt. [import]uid: 8271 topic_id: 16346 reply_id: 316346[/import]