简体   繁体   中英

Cordova email composer doesn't work on Android

I have a big problem with this plugin:

https://github.com/katzer/cordova-plugin-email-composer

when i tried to send email on ios, all work well. but when i tried in Android, it did nothing.. And i receive the callback "email view is dismissed". I tested it on some device with different android version and in a blank project. My simple code:

cordova.plugins.email.open({app: 'mailto'}, function () {
    console.log('email view dismissed');
}, this);

I solved this problem by installing this:

cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git#0.8.2

and remove the last version.

add the following code at the indicated address, in new versions of android it requests the action of sending mail

...\\platforms\\android\\app\\src\\main\\AndroidManifest.xml

<queries>
    <intent>
    <action android:name="android.intent.action.SENDTO" />
    <data android:scheme="mailto" />
    </intent>
</queries>

Following the process at this link helped me:

https://forum.ionicframework.com/t/cordovaemailcomposer-can-not-send-mail/50395/11

ignore the ionic part.

--EDIT--

You may try with these steps:

  1. Remove the plugin and android platform from your project.

  2. Add the email plugin from here: https://github.com/katzer/cordova-plugin-email-composer.git

  3. Add the Android platform.

I think the trick is you need to add the plugin before adding the android platform. Sounds silly but worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM