sidlatau / flutter_email_sender

Allows send emails from flutter using native platform functionality.
Apache License 2.0
146 stars 81 forks source link

[Android] Options to send email via email client shows full list of available programs #95

Open IshchikGL opened 1 year ago

IshchikGL commented 1 year ago

After switching to version 6.0.1 I see that there is no more "only mail apps" chooser but instead I can send an email via available programs on device. I receive this stacktrace whenever I call .send method with multiple attachments.

W/Bundle  ( 4877): Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a java.lang.String.  The default value <null> was returned.
W/Bundle  ( 4877): Attempt to cast generated internal exception:
W/Bundle  ( 4877): java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList
W/Bundle  ( 4877):  at android.os.BaseBundle.getCharSequenceArrayList(BaseBundle.java:1307)
W/Bundle  ( 4877):  at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1095)
W/Bundle  ( 4877):  at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:8664)
W/Bundle  ( 4877):  at android.content.Intent.migrateExtraStreamToClipData(Intent.java:11649)
W/Bundle  ( 4877):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1710)
W/Bundle  ( 4877):  at android.app.Activity.startActivityForResult(Activity.java:5252)
W/Bundle  ( 4877):  at android.app.Activity.startActivityForResult(Activity.java:5203)
W/Bundle  ( 4877):  at com.sidlatau.flutteremailsender.FlutterEmailSenderPlugin.sendEmail(FlutterEmailSenderPlugin.kt:171)
W/Bundle  ( 4877):  at com.sidlatau.flutteremailsender.FlutterEmailSenderPlugin.onMethodCall(FlutterEmailSenderPlugin.kt:72)
W/Bundle  ( 4877):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
W/Bundle  ( 4877):  at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
W/Bundle  ( 4877):  at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
W/Bundle  ( 4877):  at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
W/Bundle  ( 4877):  at android.os.Handler.handleCallback(Handler.java:883)
W/Bundle  ( 4877):  at android.os.Handler.dispatchMessage(Handler.java:100)
W/Bundle  ( 4877):  at android.os.Looper.loop(Looper.java:237)
W/Bundle  ( 4877):  at android.app.ActivityThread.main(ActivityThread.java:8016)
W/Bundle  ( 4877):  at java.lang.reflect.Method.invoke(Native Method)
W/Bundle  ( 4877):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/Bundle  ( 4877):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)

Reproduces on Samsung S20(Android 10) and Pixel 7(Android 13)

bulatsema0 commented 1 year ago

Yes, after the update, I am also unable to build and facing the same issue. It would make me very happy if you could resolve it as soon as possible. Thank you. FAILURE: Build failed with an exception.

Gilianp commented 7 months ago

Same here with 6.0.2 version

teekamsuthar commented 6 months ago

Any update on how you fixed this?

Gilianp commented 6 months ago

It's even worse when the list of available email programs appears, and then the user taps away (closing the list). The app doesn't know about this cancellation gesture. How will I know when this happens? Or better: how I force an specific email app? (like gmail)