FileOpener2

这个插件将打开你的设备文件系统的文件,其默认应用程序。

打开APK安装对话框

1.module.controller('MyCtrl', function($scope, $cordovaFileOpener2) {
2.
3. $cordovaFileOpener2.open(
4. '/sdcard/Download/gmail.apk',
5. 'application/vnd.android.package-archive'
6. ).then(function() {
7. // Success!
8. }, function(err) {
9. // An error occurred. Show a message to the user
10. });
11.
12.});

用默认的PDF阅读器和可选的回调对象打开PDF文档

1.module.controller('MyCtrl', function($scope, $cordovaFileOpener2) {
2.
3. $cordovaFileOpener2.open(
4. '/sdcard/Download/starwars.pdf',
5. 'application/pdf'
6. ).then(function() {
7. // file opened successfully
8. }, function(err) {
9. // An error occurred. Show a message to the user
10. });
11.
12.});

卸载一个APP,通过appid

1. module.controller(‘MyCtrl’, function($scope, $cordovaFileOpener2) {
2.
3.$cordovaFileOpener2.uninstall(‘com.zynga.FarmVille2CountryEscape’).then(function() { // Uninstall intent activity started. }, function(err) { // An error occurred. Show a message to the user });
4.
5.});

检查一个应用程序是否已经安装。

1.module.controller('MyCtrl', function($scope, $cordovaFileOpener2) {
2.
3.$cordovaFileOpener2.appIsInstalled('com.adobe.reader').then(function(res) {
4. if (res.status === 0) {
5. // Adobe Reader is not installed.
6. } else {
7. // Adobe Reader is installed.
8. }
9. });
10.
11.});