简体   繁体   中英

Cordova EmailComposer Plugin - callback function is not working

Short description:

I develop an Android app using Phonegap 3.5.0 (JavaScript, CSS3 and HTML5) on Windows. The main function of the application is to fill a form and send it by e-mail using smartphone's Gmail client. In detail, a user clicks the Send button in app's main view after the form is filled and he will be prompted to choose e-mail client options. He will pick Gmail and send the pre-composed e-mail.

What do I need:

I need to know when the email view has been dismissed to navigate the app to another view that will show that e-mail has been successfully sent (if it was). From now I will call it success page.

What do I have:

I use the Cordova EmailComposer Plugin and its callback option. It is described on the official GitHub page:

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

The open method supports additional callback to get informed when the view has been dismissed.

window.plugin.email.open(properties, function () {
    console.log('email view dismissed');
}, this);

In my app I have this piece of code that triggers the e-mail view.

        window.plugin.email.open({
            to: to,
            subject: subject,
            body: body
        }, function(){
            $.mobile.changePage($("#emailSent"), "fade", true, true); //callback function to navigate to the "success" page after the e-mail view has been dismissed.    
        }, this);

The problem:

The app returns to the same page from where the user pressed the Send button after an e-mail has been sent. There is no redirection to the "success" page.

Main question: What am I implementing wrong?

For the callback, take a look at this example: http://plugins.telerik.com/plugin/emailcomposer

Maybe your plugin version is not the latest because the callback has been recently (re)added.

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