Sometimes the plugin doesn't attach every attachments in the array (usually total minus one). This happens completely random.
Tested tablets: Galaxy Tab S2, Galaxy Tab A 8 inches, Galaxy Tab S6 lite
Tested Android versions: 7, 11, 11
Default email app: Outlook
A couple of Galaxy Tab A 8 inches users switched to Gmail app and apparently solved the problem, this solution didn't work for the Galaxy Tab S2 users.
When an array of files is attached i get this log:
03-31 15:19:59.240 13728 13728 D CordovaInterfaceImpl: Sending activity result to plugin
03-31 15:19:59.240 13728 13728 D CordovaActivity: Incoming Result. Request code = 0
03-31 15:19:59.238 13728 13728 D CordovaActivity: Paused the activity.
03-31 15:19:59.223 13728 14748 W Bundle : at java.lang.Thread.run(Thread.java:923)
03-31 15:19:59.223 13728 14748 W Bundle : at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-31 15:19:59.223 13728 14748 W Bundle : at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-31 15:19:59.223 13728 14748 W Bundle : at de.appplant.cordova.emailcomposer.EmailComposer$4.run(EmailComposer.java:175)
03-31 15:19:59.223 13728 14748 W Bundle : at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:68)
03-31 15:19:59.223 13728 14748 W Bundle : at android.app.Activity.startActivityForResult(Activity.java:5340)
03-31 15:19:59.223 13728 14748 W Bundle : at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:352)
03-31 15:19:59.223 13728 14748 W Bundle : at android.app.Activity.startActivityForResult(Activity.java:5382)
03-31 15:19:59.223 13728 14748 W Bundle : at android.app.Instrumentation.execStartActivity(Instrumentation.java:1721)
03-31 15:19:59.223 13728 14748 W Bundle : at android.content.Intent.migrateExtraStreamToClipData(Intent.java:12048)
03-31 15:19:59.223 13728 14748 W Bundle : at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:9012)
03-31 15:19:59.223 13728 14748 W Bundle : at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1145)
03-31 15:19:59.223 13728 14748 W Bundle : at android.os.BaseBundle.getCharSequenceArrayList(BaseBundle.java:1343)
03-31 15:19:59.223 13728 14748 W Bundle : java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList
03-31 15:19:59.223 13728 14748 W Bundle : Attempt to cast generated internal exception:
03-31 15:19:59.220 13728 14748 W Bundle : Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a java.lang.String. The default value <null> was returned.
03-31 15:19:59.154 13728 15191 D PluginManager: getPlugin - put: EmailComposer
03-31 15:19:58.098 13728 14748 D TEST : cdvfile://localhost/files/28384_rapportino.pdf: 463056
03-31 15:19:57.012 13728 14748 D TEST : cdvfile://localhost/files/28383_rapportino.pdf: 223247
Code i'm using:
var email_ref_client = "james@example.org";
var email_cc = "alex@example.org";
var subject = "Test";
var body = "PDF reports";
var email_client = "outlook";
var files = [];
files.push('app://files/28384_rapportino.pdf');
files.push('app://files/28383_rapportino.pdf');
cordova.plugins.email.open({
to: email_ref_client,
cc: email_cc,
subject: subject,
body: body,
app: email_client,
attachments: files,
}, function() {
window.location.href = 'main.html';
});
Sometimes the plugin doesn't attach every attachments in the array (usually total minus one). This happens completely random.
Tested tablets: Galaxy Tab S2, Galaxy Tab A 8 inches, Galaxy Tab S6 lite
Tested Android versions: 7, 11, 11
Default email app: Outlook
A couple of Galaxy Tab A 8 inches users switched to Gmail app and apparently solved the problem, this solution didn't work for the Galaxy Tab S2 users.
When an array of files is attached i get this log:
Code i'm using: