The native.showPopup method for "mail" does not do anything on Android

Hi,

I’m trying to open the mail app from my game and it’s not showing up. It works well on iOS (and in the simulator) but not on Android. 

My code is this:

local body = "Target App Store: " .. device.targetAppStore body = body .. "\nPlatform: " .. device.platform body = body .. "\nPlatform Version: " .. system.getInfo("platformVersion") body = body .. "\nApp Version: " .. system.getInfo("appVersionString") body = body .. "\n\nUser Comments: " local done = native.showPopup("mail", { to = "contact@squadventure.com", subject = "Feedback", body = body }) if not done then print("Function native.showPopup is not supported.") native.showAlert(game.info.getGameName(), i18n.\_"Ratings.Feedback") --system.openURL("mailto:contact@squadventure.com?subject=Feedback" .. "&body=" .. urlencode(body)) end

The showPopup function returns true, because it doesn’t go inside the subsequent if-block. I don’t see any errors in the log. By the way, using openURL doesn’t work either.

Has anyone experienced this? Do I need to add anything to permissions for this to work?

Thanks,

George

edit: I’m using v2016.2861. 

Did some more debugging and found that the problem wasn’t with showPopup because it’s never actually called. That code was inside the handler for an alert, and the handler is never called. This only happens when the alert is nested within another alert.

The solution is to call the nested showAlert within a timer, like so:

timer.performWithDelay(0, function() native.showAlert(game.info.getGameName(), "foo", { "bar", "baz" }, onAlertComplete) end)

This was reported by someone else a few months ago as well:

https://forums.coronalabs.com/topic/60771-nativeshowalert-bug-on-android-with-solution/

This is clearly a bug or at least should be mentioned in the docs.

Did some more debugging and found that the problem wasn’t with showPopup because it’s never actually called. That code was inside the handler for an alert, and the handler is never called. This only happens when the alert is nested within another alert.

The solution is to call the nested showAlert within a timer, like so:

timer.performWithDelay(0, function() native.showAlert(game.info.getGameName(), "foo", { "bar", "baz" }, onAlertComplete) end)

This was reported by someone else a few months ago as well:

https://forums.coronalabs.com/topic/60771-nativeshowalert-bug-on-android-with-solution/

This is clearly a bug or at least should be mentioned in the docs.