簡體   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