Reputation: 412
Current behavior: I have installed the email composer components as per the ionic documentation and the isAvailable function is not available. I have read various documents regarding this subject but cannot find any way to get the method to work.
The rest of the plugin works perfectly when sending emails on my Android device so the plugin is definitely installed and working.
Error: Uncaught (in promise): TypeError: EmailComposer.getPlugin(...).isAvailable is not a function
Expected behavior: I would expect the isAvailable method to return true or false.
Steps to reproduce:
Related code:
import { Component } from '@angular/core';
import { EmailComposer } from '@ionic-native/email-composer/ngx';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss']
})
export class HomePage {
constructor(private emailComposer: EmailComposer) {}
public canEmail: boolean = false;
ionViewDidEnter() {
this.emailComposer.isAvailable().then((available: boolean) => {
if (available) {
this.canEmail = true;
}
});
}
}
Other information:
Ionic:
Ionic CLI : 5.4.2 (C:\Users\andy\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.11.3
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 5 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (c:\Android\Sdk)
NodeJS : v10.15.2 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
Upvotes: 0
Views: 821
Reputation: 412
Just in case it helps anybody else out there.
After a few days of investigation I have come to the conclusion that the cordova-plugin-email-composer
is out of line with the Ionic native library. I have attempted to resolve the issue myself and my @ionic-native
fork is available here @ionic-native the specific file I have changed is located here src\@ionic-native\plugins\email-composer.index.ts
.
I have created a pull request in the main ionic-native repository but its my first attempt of any kind contributing to a project like this so not sure on the outcome!
Upvotes: 1