首先,我們定義乙個資料結構,來儲存應用程式資訊(icon,name,packagename,versionname,versioncode,等)-------------------------
public string packagename="";
public string versionname="";
public int versioncode=0;
public void print()
然後我們通過packagemanager 來獲取已安裝的應用包資訊。-----------------------------------
listpackages =getpackagemanager().getinstalledpackages(0);
for(int i=0;ipackageinfo packageinfo =packages.get(i);
tmpinfo.packagename =packageinfo.packagename; //包名
tmpinfo.versionname =packageinfo.versionname; //版本名
tmpinfo.versioncode =packageinfo.versioncode; //版本號
那麼如何判斷乙個應用是否為系統應用呢?-------------------------------------
//非系統應用
else{ //系統應用
所以如果只需要獲取到非系統應用資訊,**如下:-------------------------------
listpackages = getpackagemanager().getinstalledpackages(0);
for(int i=0;ipackageinfo packageinfo =packages.get(i);
tmpinfo.packagename =packageinfo.packagename;
tmpinfo.versionname =packageinfo.versionname;
tmpinfo.versioncode =packageinfo.versioncode;
獲取已安裝apk檔案資訊
眾所周知,通過packagemanager可以獲取手機端已安裝的apk檔案的資訊,具體 如下 packagemanager packagemanager this.getpackagemanager listpackageinfolist packagemanager.getinstalledpac...
獲取所有已安裝的應用
1.獲取packagemanager packagemanager manager getcontext getpackagemanager 2.獲取已安裝的應用 listpackageinfos manager.getinstalledpackages 0 3.遍歷 packageinfo列表,獲...
獲取手機應用資訊
systemutils.j a工具類 j a package com.techrare.utils import j a.util.arraylist import j a.util.list import android.content.context import android.content...