Android 獲取已經安裝的程序:
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import Allappinfo.AllAppInfo; import android.app.Activity; import android.content.pm.PackageInfo; import android.os.Bundle; public class AllAppActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get(); ArrayList<AllAppInfo> list=Get(); for (Iterator iterator = list.iterator(); iterator.hasNext();) { AllAppInfo allAppInfo = (AllAppInfo) iterator.next(); System.out.println(allAppInfo.getAppname()+" |"+allAppInfo.getPackagename()+"| "+allAppInfo.getVersionCode()+"|"+allAppInfo.getLastInstal()+"|"+allAppInfo.getInstalPath()); } } private ArrayList<AllAppInfo> Get(){ ArrayList<AllAppInfo> appList = new ArrayList<AllAppInfo>(); List<PackageInfo> packageInfos=getPackageManager().getInstalledPackages(0); for (int i = 0; i < packageInfos.size(); i++) { PackageInfo pInfo=packageInfos.get(i); AllAppInfo allAppInfo=new AllAppInfo(); allAppInfo.setAppname(pInfo.applicationInfo.loadLabel(getPackageManager()).toString());//應用程序的名稱 allAppInfo.setPackagename(pInfo.packageName);//應用程序的包 allAppInfo.setVersionCode(pInfo.versionCode);//版本號 allAppInfo.setLastInstal(pInfo.firstInstallTime); //allAppInfo.setProvider(pInfo.providers); allAppInfo.setInstalPath(pInfo.applicationInfo.sourceDir); allAppInfo.setAppicon(pInfo.applicationInfo.loadIcon(getPackageManager())); appList.add(allAppInfo); } return appList; } }
Android程序ToDoList
Android獲取應用程序的版本信息
程序中如何獲取Android的Root權限
Android在線更新 遠程安裝程序
Android 程序時時獲取logcat信息
Android 程序安裝以後不要顯示圖標
在Android程序中獲取avc中的數據
Android 獲取系統和應用程序