简体   繁体   中英

Phonegap: Can't get Email Composer to work

I've spent a couple of days trying to implement emailing functionality to my app, but I can't get it to work.

I'm trying to use the plugin (or plugins, as description claims) from here: https://build.phonegap.com/plugins/705

I've added the following code to my XML file:

<gap:plugin name="de.appplant.cordova.plugin.email-composer" version="0.8.1" />

Then for testing I created a simple page with a simple code, just to see how it would look. Here is how my JS piece looks:

document.addEventListener('deviceready', function(){
 $('#composertest').click(function(){
 alert('tapped');
 window.plugin.email.isServiceAvailable(function (isAvailable) {
        if (!isAvailable){
         alert('Service is not available');
        }else {
         alert('Service is available');
        }
    });
 window.plugin.email.open();
 alert('worked(?)');
 });
}, false);

The weird thing is that I get both alerts "tapped" and "worked", so if there would be an error, the last alert shouldn't be executed. However I don't get any popup or new window, the plugin seems to do nothing. Alerts about the service don't fire. I've tried to return the type of window.plugin.email in alert and it wrote "Object", so it is not undefined.

I've tried so many things now (including other plugins) that I'm completely lost with clues. Last time I tried to remove JQMobile, but it didn't change anything. Right now the code is very simple and uses as few files as possible and still it doesn't work. I've also tried to make a lot of changes in the code (and also tried the exact example from the docs page) and never got to the point where plugin does anything.

Am I missing something? Is there a working example somewhere?

PS: Phonegap debugger doesn't return any errors, although I don't trust it too much, since it's quite buggy.

If you just want to send a mail within PhoneGap you can just use mailto URI scheme.

Here are some links:

This will send an email intent in Android then the user can choose which app to open the mail in.

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