issue with native.showPopup ("mail")?

No matter how I try I’m unable to get my samsung to open it’s default email app when triggering the 

native.showPopup (“mail”).

Code I use is:

local options =

 {to = { “x@xx.com”},

subject = “xx”,

body = “xxxx”,

attachment =

{

 { baseDir=system.DocumentsDirectory, filename=“xx.db”, type=“text” }

},

 }

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

if not result then

native.showAlert( “Oops!”,“The default email app is not supported/setup on this device.”, { “OK” });

end

12-02 22:15:36.554: W/Bundle(28763): Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a java.lang.String.  The default value <null> was returned.

12-02 22:15:36.554: W/Bundle(28763): Attempt to cast generated internal exception:

12-02 22:15:36.554: W/Bundle(28763): java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList

12-02 22:15:36.554: W/Bundle(28763): at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1367)

12-02 22:15:36.554: W/Bundle(28763): at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:5333)

12-02 22:15:36.554: W/Bundle(28763): at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7901)

12-02 22:15:36.554: W/Bundle(28763): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1423)

12-02 22:15:36.554: W/Bundle(28763): at android.app.Activity.startActivityForResult(Activity.java:3582)

12-02 22:15:36.554: W/Bundle(28763): at android.app.Activity.startActivityForResult(Activity.java:3543)

12-02 22:15:36.554: W/Bundle(28763): at com.ansca.corona.CoronaActivity.showSendMailWindowUsing(CoronaActivity.java:1841)

12-02 22:15:36.554: W/Bundle(28763): at com.ansca.corona.CoronaShowApiHandler.showSendMailWindowUsing(CoronaShowApiHandler.java:52)

12-02 22:15:36.554: W/Bundle(28763): at com.ansca.corona.Controller$9.run(Controller.java:1011)

12-02 22:15:36.554: W/Bundle(28763): at android.os.Handler.handleCallback(Handler.java:733)

12-02 22:15:36.554: W/Bundle(28763): at android.os.Handler.dispatchMessage(Handler.java:95)

12-02 22:15:36.554: W/Bundle(28763): at android.os.Looper.loop(Looper.java:146)

12-02 22:15:36.554: W/Bundle(28763): at android.app.ActivityThread.main(ActivityThread.java:5653)

12-02 22:15:36.554: W/Bundle(28763): at java.lang.reflect.Method.invokeNative(Native Method)

12-02 22:15:36.554: W/Bundle(28763): at java.lang.reflect.Method.invoke(Method.java:515)

12-02 22:15:36.554: W/Bundle(28763): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)

12-02 22:15:36.554: W/Bundle(28763): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)

12-02 22:15:36.554: W/Bundle(28763): at dalvik.system.NativeStart.main(Native Method)

AFAIR “to” should be a string, not a table.

local options = {to = "x@xx.com", subject = "xx", ......

it worked fine on IOS so i figured it was still okay even though it was sending to only 1 email instead of more then one which initially I was sending to. Doesn’t make any difference actually, as won’t work how you suggested either.

Perhaps the corona guys can provide some info? The core error seems to be this below, so do we need to set an android permission to use email?

 Implicit intents with startService are not safe: Intent { act=com.android.email.POLICY_INTENT } android.content.ContextWrapper.bindService:529 com.android.emailcommon.service.ServiceProxy.setTask:170 com.android.emailcommon.service.ServiceProxy.setTask:153 

Hi @jacques1,

Out of curiosity, which permissions are you providing at this time? Can you post a list?

Thanks,

Brent

Hi Brent, perhaps I’m missing something? (just showing the whole build.settings just in case)

settings =

{

plugins =

{

[“CoronaProvider.gameNetwork.apple”] =

{

publisherId = “com.coronalabs”,

supportedPlatforms = { iphone=true, [“iphone-sim”]=true },

},

},

iphone =

{

plist =

{

UIPrerenderedIcon = true,

UIStatusBarHidden = true,

UIApplicationExitsOnSuspend = false,

CFBundleIconFile = “Icon.png”,

CFBundleIconFiles = {

“Icon.png”,

“Icon@2x.png”,

“Icon-60.png”,

“Icon-60@2x.png”,

“Icon-60@3x.png”,

“Icon-72.png”,

“Icon-72@2x.png”,

“Icon-76.png”,

“Icon-76@2x.png”,

“Icon-Small-40.png”,

“Icon-Small-40@2x.png”,

“Icon-Small-40@3x.png”,

“Icon-Small-50.png”,

“Icon-Small-50@2x.png”,

“Icon-Small.png”,

“Icon-Small@2x.png”,

“Icon-Small@3x.png”

},

UILaunchStoryboardName = “LaunchScreen”,

CFBundleIdentifier = “com.vdvgames.zwar”,

CFBundleDisplayName = “WOTZ”,

UIAppFonts =

{

“boston.ttf”,

“eurobold.ttf”,

“final.ttf”,

“exo.otf”

}

},

},

android =

    {

    largeHeap = true,

    usesExpansionFile = true,

        versionCode = “165”,

        usesPermissions =

        {

            “android.permission.INTERNET”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            “com.android.vending.CHECK_LICENSE”

        },

    },

orientation =

{

default = “landscape”,

supported =

{

“landscape”,

“landscapeRight”,

“landscapeLeft”,

},

}

}

Hi @jacques1,

Can you please build and test our sample project “Networking > ComposeEmailSMS” and see what happens?

Thanks,

Brent

Hi Brent,

I can confirm that this is happening with the ComposeEmailSMS sample too. It only happens on my Nexus 5 running Android 5+. On my HTC One running Android 4.2.2 it behaves as expected.

Let us know your thoughts and happy holidays!

Cheers,

Marcos

Hi guys,

Can one of you please log a bug report for this, so it gets in the logging system? You can just use our sample project as the code to submit, since it’s been revealed to happen in there too.

http://developer.coronalabs.com/content/bug-submission

Thanks,

Brent

Hi guys,

Here’s an update from our side. We’ve tested it on a Nexus 7 Android 5.0 “L” device and it works fine. We’ve additionally tested it via our “ComposeEmailSMS” app with HTML email and non-HTML email, and sending mail to the device’s default “Gmail” app. We’ve also tested it on our Nexus 5 Android 4.4 “KitKat” device and it works.

The “ClassCastException” warnings you’re seeing in the log are harmless. It’s just noise generated by the mail app as it attempts to fetch mail settings in a variety of ways. Normally you would send the mail message as a string, which is what Corona developers and most native Android developers do, but the mail app also attempts to fetch the mail contents via other Java types such as that array of characters. Again, this is harmless and we see these log messages on our devices where the mail popup works.

Here are some questions we need to ask you at this point:

  1. What is the exact name of the mail app you’re trying to compose mail with? Gmail? Some 3rd-party mail app? If it’s a 3rd-party mail app, then it might be bug on that app’s side.

  2. Do you have an account set up in the mail app? If you don’t in the Gmail app, then the “Compose Mail” window will fail to show up and you’ll get the “Welcome to Gmail” window instead. We can’t do anything about that on our side.

  3. Are there any updates that need to be done for the mail app? If the device was upgraded to Android 5.0, then you may need to have the mail app upgraded too in case it has any compatibility issues.

  4. Have you tried rebooting the phone? This is in case the mail app is in a bad state.

Best regards,

Brent

AFAIR “to” should be a string, not a table.

local options = {to = "x@xx.com", subject = "xx", ......

it worked fine on IOS so i figured it was still okay even though it was sending to only 1 email instead of more then one which initially I was sending to. Doesn’t make any difference actually, as won’t work how you suggested either.

Perhaps the corona guys can provide some info? The core error seems to be this below, so do we need to set an android permission to use email?

 Implicit intents with startService are not safe: Intent { act=com.android.email.POLICY_INTENT } android.content.ContextWrapper.bindService:529 com.android.emailcommon.service.ServiceProxy.setTask:170 com.android.emailcommon.service.ServiceProxy.setTask:153 

Hi @jacques1,

Out of curiosity, which permissions are you providing at this time? Can you post a list?

Thanks,

Brent

Hi Brent, perhaps I’m missing something? (just showing the whole build.settings just in case)

settings =

{

plugins =

{

[“CoronaProvider.gameNetwork.apple”] =

{

publisherId = “com.coronalabs”,

supportedPlatforms = { iphone=true, [“iphone-sim”]=true },

},

},

iphone =

{

plist =

{

UIPrerenderedIcon = true,

UIStatusBarHidden = true,

UIApplicationExitsOnSuspend = false,

CFBundleIconFile = “Icon.png”,

CFBundleIconFiles = {

“Icon.png”,

“Icon@2x.png”,

“Icon-60.png”,

“Icon-60@2x.png”,

“Icon-60@3x.png”,

“Icon-72.png”,

“Icon-72@2x.png”,

“Icon-76.png”,

“Icon-76@2x.png”,

“Icon-Small-40.png”,

“Icon-Small-40@2x.png”,

“Icon-Small-40@3x.png”,

“Icon-Small-50.png”,

“Icon-Small-50@2x.png”,

“Icon-Small.png”,

“Icon-Small@2x.png”,

“Icon-Small@3x.png”

},

UILaunchStoryboardName = “LaunchScreen”,

CFBundleIdentifier = “com.vdvgames.zwar”,

CFBundleDisplayName = “WOTZ”,

UIAppFonts =

{

“boston.ttf”,

“eurobold.ttf”,

“final.ttf”,

“exo.otf”

}

},

},

android =

    {

    largeHeap = true,

    usesExpansionFile = true,

        versionCode = “165”,

        usesPermissions =

        {

            “android.permission.INTERNET”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            “com.android.vending.CHECK_LICENSE”

        },

    },

orientation =

{

default = “landscape”,

supported =

{

“landscape”,

“landscapeRight”,

“landscapeLeft”,

},

}

}

Hi @jacques1,

Can you please build and test our sample project “Networking > ComposeEmailSMS” and see what happens?

Thanks,

Brent

Hi Brent,

I can confirm that this is happening with the ComposeEmailSMS sample too. It only happens on my Nexus 5 running Android 5+. On my HTC One running Android 4.2.2 it behaves as expected.

Let us know your thoughts and happy holidays!

Cheers,

Marcos

Hi guys,

Can one of you please log a bug report for this, so it gets in the logging system? You can just use our sample project as the code to submit, since it’s been revealed to happen in there too.

http://developer.coronalabs.com/content/bug-submission

Thanks,

Brent

Hi guys,

Here’s an update from our side. We’ve tested it on a Nexus 7 Android 5.0 “L” device and it works fine. We’ve additionally tested it via our “ComposeEmailSMS” app with HTML email and non-HTML email, and sending mail to the device’s default “Gmail” app. We’ve also tested it on our Nexus 5 Android 4.4 “KitKat” device and it works.

The “ClassCastException” warnings you’re seeing in the log are harmless. It’s just noise generated by the mail app as it attempts to fetch mail settings in a variety of ways. Normally you would send the mail message as a string, which is what Corona developers and most native Android developers do, but the mail app also attempts to fetch the mail contents via other Java types such as that array of characters. Again, this is harmless and we see these log messages on our devices where the mail popup works.

Here are some questions we need to ask you at this point:

  1. What is the exact name of the mail app you’re trying to compose mail with? Gmail? Some 3rd-party mail app? If it’s a 3rd-party mail app, then it might be bug on that app’s side.

  2. Do you have an account set up in the mail app? If you don’t in the Gmail app, then the “Compose Mail” window will fail to show up and you’ll get the “Welcome to Gmail” window instead. We can’t do anything about that on our side.

  3. Are there any updates that need to be done for the mail app? If the device was upgraded to Android 5.0, then you may need to have the mail app upgraded too in case it has any compatibility issues.

  4. Have you tried rebooting the phone? This is in case the mail app is in a bad state.

Best regards,

Brent