EddyVerbruggen / nativescript-email

:envelope: NativeScript plugin for opening draft e-mails
MIT License
47 stars 15 forks source link

Exception on Android - starting email activity seems to work though #12

Open alixandru opened 7 years ago

alixandru commented 7 years ago

On Android I get this exception in the system logs, even though all paramters are correct. The email activity is started nevertheless, so this is not critical, but I think it should be taken care of anyway.

58:17.421  4014  4014 D ViewRootImpl: ViewPostImeInputStage processPointer 1
12-22 10:58:17.511  4014  4014 W Bundle  : Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a android.text.SpannableStringBuilder.  The default value <null> was returned.
12-22 10:58:17.531  4014  4014 E art     : invalid stream - problem with parameter iterator in /data/app/ro.bvb.arenaxt.next-1/base.apk for method void com.tns.gen.android.view.View_OnClickListener.onClick(android.view.View)
12-22 10:58:17.551  4014  4014 W Bundle  : Attempt to cast generated internal exception:
12-22 10:58:17.551  4014  4014 W Bundle  : java.lang.ClassCastException: android.text.SpannableStringBuilder cannot be cast to java.util.ArrayList
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.os.BaseBundle.getCharSequenceArrayList(BaseBundle.java:1067)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.os.Bundle.getCharSequenceArrayList(Bundle.java:922)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:6295)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.content.Intent.migrateExtraStreamToClipData(Intent.java:9179)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.content.Intent.migrateExtraStreamToClipData(Intent.java:9142)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.app.Instrumentation.execStartActivity(Instrumentation.java:1533)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.app.ContextImpl.startActivity(ContextImpl.java:739)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.app.ContextImpl.startActivity(ContextImpl.java:721)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.content.ContextWrapper.startActivity(ContextWrapper.java:345)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.tns.Runtime.callJSMethodNative(Native Method)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1022)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.tns.Runtime.callJSMethodImpl(Runtime.java:907)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.tns.Runtime.callJSMethod(Runtime.java:895)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.tns.Runtime.callJSMethod(Runtime.java:879)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.tns.Runtime.callJSMethod(Runtime.java:871)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.tns.gen.android.view.View_OnClickListener.onClick(android.view.View$OnClickListener.java)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.view.View.performClick(View.java:5702)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.widget.TextView.performClick(TextView.java:10888)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.view.View$PerformClick.run(View.java:22541)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.os.Handler.handleCallback(Handler.java:739)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.os.Handler.dispatchMessage(Handler.java:95)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.os.Looper.loop(Looper.java:158)
12-22 10:58:17.551  4014  4014 W Bundle  :      at android.app.ActivityThread.main(ActivityThread.java:7229)
12-22 10:58:17.551  4014  4014 W Bundle  :      at java.lang.reflect.Method.invoke(Native Method)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
12-22 10:58:17.551  4014  4014 W Bundle  :      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

This is how I use the plugin:

    email.available().then((available) => {
        if (available) {
          email.compose({
            subject: "undisclosed",
            to: ['undisclosed@undisclosed.tld'],
            cc: [],
            bcc: [],
            attachments: [],
            appPickerTitle: "Email",
            body: `
              <br><br><br>-------------------------------
              <br>OS: ${device.os} ${device.osVersion} ${device.language}
              <br>Device: ${device.manufacturer} ${device.model}
            `
          });
        } else {
          this.translate.get("feedback_not_ready").subscribe(txt => {
            toast.makeText(txt, toast.duration.long).show();
          });
        }
      }).catch(() => {
        this.translate.get("feedback_error").subscribe(txt => {
          toast.makeText(txt, toast.duration.long).show();
        });
      });

Note: I've tried with and without the empty cc/bcc/attachments parameters. Same error.