[英]Ionic get installed apps on android device with icon
我知道已经有人问过这个问题,但我在该解决方案中遇到了问题,但没有在那里回答。
我使用了这个插件,但这给了我错误:
var success = function (app_list) { alert(JSON.stringify(app_list)); };
var error = function (app_list) { alert("Oopsie! " + app_list); };
Applist.createEvent('', '', '', '', '', success, error)
我怎样才能消除这个错误? 我下载它运行:
npm i cordova-plugin-applist
错误信息:
Cannot find name 'Applist'
添加
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.