2016-02-10 28 views
2

我使用這個插件:http://ngcordova.com/docs/plugins/emailComposer/過濾器應用

這是我的角度代碼:

$scope.report = function(){ 
    var CEO_EMAIL_ADDRESS = '[email protected]'; 

    $cordovaEmailComposer.isAvailable().then(function() { 
     $cordovaEmailComposer.open({ 
      to: CEO_EMAIL_ADDRESS, 
      subject: langTranslateService.getData('REPORT_A_PROBLEM'), 
      body: '', 
      isHtml: false 
     }); 
    }); 
}; 

我只需要在手機電子郵件將被打開或選擇只從電子郵件應用程序選擇。

爲什麼選項中有「bluetooth,dropbox ...」?

我可以改變它嗎?

popup options

回答

1

據插件規範中here,你應該能夠提供一個app選項將open方式來指定一個特定的應用程序打開的電子郵件草稿(僅寫了Android的時間)。

首先別名應該用於期望的應用程序進行像這樣:

cordova.plugins.email.addAlias('outlook', 'com.microsoft.android.outlook'); 

本示例爲Outlook應用創建一個別名outlook。第二個參數是應用程序的包名,我可以通過安裝像Package Name Viewer這樣的插件來找到它。

,如果應用程序是可用的isAvailable功能的以下過載您可以驗證:

$cordovaEmailComposer.open({ 
    app: 'outlook', 
    to: CEO_EMAIL_ADDRESS, 
    subject: langTranslateService.getData('REPORT_A_PROBLEM'), 
    body: '', 
    isHtml: false 
}); 

cordova.plugins.email.isAvailable(
    'outlook', function (isAvailable, withScheme) { 
     // isAvailable indicates if sending emails is available at all 
     // withScheme is true if the desired app/scheme is available. When false the fallback of choosing an approriate app is applied 
    } 
); 

然後你可以在下面的例子中提供此別名open方法類似

現在草稿應該在Outlook中可用時打開。試一試!