distriqt / ANE-Message

Send messages from AIR using email and SMS
https://airnativeextensions.com/extension/com.distriqt.Message
0 stars 0 forks source link

Specific Android device do not open mail message with attachement #44

Closed buckleup closed 5 years ago

buckleup commented 5 years ago

We tested the application on various devices iOS / Andoird and on most of them it works fine but on some types of Android devices like the one described bellow it does not work.

We create mail message with one attachment image/png. Body and recipients are empty strings.

Expected behaviour

We use png image as an attachment for mail message and we expect that mail will be opened correctly on all devices.

Actual behaviour

On specific Android device Honor 10 (Android 8.1.0) there is an error in console and mail message does not open. But we have also information that it do not work on Samsung Galaxy S8. (Android version 8.0 and Samsung experience version 9.0)

Environment
Logs

Device logs if relevant

11-29 15:41:30.025 25572 25572 D com.distriqt.Message: SendMailActivity::onCreate()
11-29 15:41:30.025 25572 25572 D com.distriqt.Message: SendMailActivity::attachment: /data/user/0/air.sk.buckleup.respimatil/sk.buckleup.respimatil/Local Store/2018-10.png
11-29 15:41:30.025 25572 25572 D com.distriqt.Message: com.distriqt.extension.message.util.Assets::copyFileToPublicCache( /data/user/0/air.sk.buckleup.respimatil/sk.buckleup.respimatil/Local Store/2018-10.png )
11-29 15:41:30.025 25572 25572 D com.distriqt.Message: com.distriqt.extension.message.util.Assets::copyFileToPublicCache(): 2018-10.png
11-29 15:41:30.027 25572 25572 W Bundle  : Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a java.lang.String.  The default value <null> was returned.
11-29 15:41:30.028 25572 25572 W Bundle  : Attempt to cast generated internal exception:
11-29 15:41:30.028 25572 25572 W Bundle  : java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.os.BaseBundle.getCharSequenceArrayList(BaseBundle.java:1269)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1075)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:7383)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.content.Intent.migrateExtraStreamToClipData(Intent.java:10252)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.content.Intent.migrateExtraStreamToClipData(Intent.java:10191)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1622)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.Activity.startActivityForResult(Activity.java:4733)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.Activity.startActivityForResult(Activity.java:4673)
11-29 15:41:30.028 25572 25572 W Bundle  :  at com.distriqt.extension.message.activities.SendMailActivity.onCreate(SendMailActivity.java:63)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.Activity.performCreate(Activity.java:7362)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.Activity.performCreate(Activity.java:7353)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1219)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3120)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3278)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.ActivityThread.-wrap12(Unknown Source:0)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.os.Handler.dispatchMessage(Handler.java:109)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.os.Looper.loop(Looper.java:166)
11-29 15:41:30.028 25572 25572 W Bundle  :  at android.app.ActivityThread.main(ActivityThread.java:7377)
11-29 15:41:30.028 25572 25572 W Bundle  :  at java.lang.reflect.Method.invoke(Native Method)
11-29 15:41:30.028 25572 25572 W Bundle  :  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
11-29 15:41:30.028 25572 25572 W Bundle  :  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
11-29 15:41:30.028 25572 25572 W System.err: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/air.sk.buckleup.respimatil/cache/2018-10.png exposed beyond app through ClipData.Item.getUri()
11-29 15:41:30.028 25572 25572 W System.err:    at android.os.StrictMode.onFileUriExposed(StrictMode.java:1977)
11-29 15:41:30.028 25572 25572 W System.err:    at android.net.Uri.checkFileUriExposed(Uri.java:2363)
11-29 15:41:30.028 25572 25572 W System.err:    at android.content.ClipData.prepareToLeaveProcess(ClipData.java:942)
11-29 15:41:30.028 25572 25572 W System.err:    at android.content.Intent.prepareToLeaveProcess(Intent.java:10055)
11-29 15:41:30.028 25572 25572 W System.err:    at android.content.Intent.prepareToLeaveProcess(Intent.java:10061)
11-29 15:41:30.028 25572 25572 W System.err:    at android.content.Intent.prepareToLeaveProcess(Intent.java:10040)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1623)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.Activity.startActivityForResult(Activity.java:4733)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.Activity.startActivityForResult(Activity.java:4673)
11-29 15:41:30.028 25572 25572 W System.err:    at com.distriqt.extension.message.activities.SendMailActivity.onCreate(SendMailActivity.java:63)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.Activity.performCreate(Activity.java:7362)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.Activity.performCreate(Activity.java:7353)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1219)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3120)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3278)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.ActivityThread.-wrap12(Unknown Source:0)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894)
11-29 15:41:30.028 25572 25572 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:109)
11-29 15:41:30.028 25572 25572 W System.err:    at android.os.Looper.loop(Looper.java:166)
11-29 15:41:30.028 25572 25572 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:7377)
11-29 15:41:30.028 25572 25572 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
11-29 15:41:30.028 25572 25572 W System.err:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
11-29 15:41:30.028 25572 25572 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
11-29 15:41:30.028 25572 25572 D com.distriqt.Message: SendMailActivity::ERROR
marchbold commented 5 years ago

Can you please post the as3 code that is causing this issue and we'll look into it?

marchbold commented 5 years ago

Actually I think I may have located the issue, can you try this updated version:

https://www.dropbox.com/s/pm1d0yb581890gq/com.distriqt.Message.v5.2.012.zip?dl=0

You'll need to add the following to your manifest inside the application node. You will need to replace APPLICATION_ID with your application package name (generally your application id prefixed by air.)

<provider
    android:name="com.distriqt.extension.message.content.MessageFileProvider"
    android:authorities="APPLICATION_ID.messagefileprovider"
    android:grantUriPermissions="true"
    android:exported="false">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/distriqt_message_paths" />
</provider>
buckleup commented 5 years ago

Yes new version of .ane fixed the issue. It is also working wihtout additional manifest. Thank you.

marchbold commented 5 years ago

Excellent! I'll push this update out later today.

Do you have a fileprovider addition from one of our other ANEs as it will fallback to use that if this one isn't supplied? I do suggest you add this manifest as well though for clarity and in case any future updates of the ANE change this behaviour.