繁体   English   中英

离子在Android设备上安装应用程序

[英]Ionic get installed apps on android device

我是 ionic 框架和移动应用程序的新手,是否有任何插件或方法可以获取 android 设备上已安装应用程序的列表?

确实有一个现成的 Cordova 插件可用,可提供设备中已安装应用程序的列表。 这个AppList 插件应该可以帮助你。

事实上,它也提供了应用程序图标。

更新:据我所知,目前还没有适用于 iOS 的现成插件。

添加

import * as Applist from 'cordova-plugin-applist2/www/Applist.js';
import { Platform } from '@ionic/angular';

到您的组件 .ts 文件

然后在可能的构造函数中使用它

constructor(public platform: Platform) {
  platform.ready().then(
    function(){
      if(platform.is('android') && !platform.is('mobileweb')){
          var success = function(app_list) { 
            //success function
            console.log(app_list);
           };
          var error = function(app_list) {  
            //error          
            console.log("An Error occured while fetching App Lists");
            console.error(app_list);
          };
          //for the date parameters, any date is okay, 
          //the first date should be in the past
          Applist.createEvent('', '', '', new Date(1999, 10, 11, 12, 12, 12, 12), new Date(), success, error);
      }
    }
  );
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM