[英]Ionic get installed apps on android device
我是 ionic 框架和移动应用程序的新手,是否有任何插件或方法可以获取 android 设备上已安装应用程序的列表?
There is indeed a ready-made Cordova plugin available that gives the list of installed apps in the device.确实有一个现成的 Cordova 插件可用,可提供设备中已安装应用程序的列表。 This AppList Plugin should help you out.
这个AppList 插件应该可以帮助你。
Infact it gives the app icon as well.事实上,它也提供了应用程序图标。
UPDATE: There are no such ready-made plugin available yet for iOS as far as I know.更新:据我所知,目前还没有适用于 iOS 的现成插件。
Add添加
import * as Applist from 'cordova-plugin-applist2/www/Applist.js';
import { Platform } from '@ionic/angular';
to your component .ts file到您的组件 .ts 文件
Then to use it in probably constructor然后在可能的构造函数中使用它
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.