native.canShowPopup("mail") showing false

Can someone explain to me why I might not be able to show the “mail” popup? Under what conditions would I not be able to access a phone’s native mail program? Just to be clear, I _can _show the mail program under some conditions within my program. However, sometimes it doesn’t work. Why might this be?

Thanks for any help. 

Actually, my problem is even more perplexing. I’ve figured out why the simulator is showing that the popup can’t be shown. It’s simply because the simulator doesn’t support the mail popup. However, my device is telling me that the popup _can _be shown, yet it is not showing it. 

My code is as follows:

[lua]

if native.canShowPopup(“mail”) then

    print(“Can Show Popup”)

    native.showPopup(“mail”, options)

    comments.text = “Can show popup”

else

    print(“Can’t show popup”)

    comments.text = “Can’t show popup”

end

[/lua]

“comments.text” refers to a text field that I have put on the screen in leu of the terminal window. When I run the program on my device, the comments field displays “Can show popup” but does not actually bring up the popup. Why could this be? 

What is your options table like?

[lua]local options = 

{

    to = “email@address.com”,

    subject = sub_text,

    body = "\nDate: " … date.year … “-” … date.month … “-” … date.day … "\nTime: " … date.hour … “:” … date.min … “:” … date.sec … "\nName: " … name … "\nEmail: " … email … "\nComments: " … comments.text … “\n”,

    attachment = {baseDir = system.DocumentsDirectory, filename = “recentphoto.jpg”, type = “image”},

}

[/lua]

Actually, my problem is even more perplexing. I’ve figured out why the simulator is showing that the popup can’t be shown. It’s simply because the simulator doesn’t support the mail popup. However, my device is telling me that the popup _can _be shown, yet it is not showing it. 

My code is as follows:

[lua]

if native.canShowPopup(“mail”) then

    print(“Can Show Popup”)

    native.showPopup(“mail”, options)

    comments.text = “Can show popup”

else

    print(“Can’t show popup”)

    comments.text = “Can’t show popup”

end

[/lua]

“comments.text” refers to a text field that I have put on the screen in leu of the terminal window. When I run the program on my device, the comments field displays “Can show popup” but does not actually bring up the popup. Why could this be? 

What is your options table like?

[lua]local options = 

{

    to = “email@address.com”,

    subject = sub_text,

    body = "\nDate: " … date.year … “-” … date.month … “-” … date.day … "\nTime: " … date.hour … “:” … date.min … “:” … date.sec … "\nName: " … name … "\nEmail: " … email … "\nComments: " … comments.text … “\n”,

    attachment = {baseDir = system.DocumentsDirectory, filename = “recentphoto.jpg”, type = “image”},

}

[/lua]

From my research the email popup [native.showPopup(“mail”, options)] won’t show if there are no email accounts added. What’s worse in that case native.canShowPopup( “mail” ) is returning true. Is there a way to detect that there are no email accounts?

Device: iPod touch 4G

iOS 6.1.3

Corona Build: 1257

Yeah.

If you do:.

local result = native.showPopup( “mail”, options )

Then result will be false if it cannot display the popup ie:

if result == false then
– no mail account set up
end

Hope this helps

Thank you Danny. This solves my problem.

From my research the email popup [native.showPopup(“mail”, options)] won’t show if there are no email accounts added. What’s worse in that case native.canShowPopup( “mail” ) is returning true. Is there a way to detect that there are no email accounts?

Device: iPod touch 4G

iOS 6.1.3

Corona Build: 1257

Yeah.

If you do:.

local result = native.showPopup( “mail”, options )

Then result will be false if it cannot display the popup ie:

if result == false then
– no mail account set up
end

Hope this helps

Thank you Danny. This solves my problem.