一、獲取APP名字、圖標、版本等信息
/** 獲取單個App圖標 **/
public Drawable getAppIcon(String packageName) throws NameNotFoundException {
Drawable icon = pManager.getApplicationIcon(packageName);
return icon;
}
/** 獲取單個App名稱 **/
public String getAppName(String packageName) throws NameNotFoundException {
ApplicationInfo appInfo = pManager.getApplicationInfo(packageName, 0);
String appName = pManager.getApplicationLabel(appInfo).toString();
return appName;
}
/** 獲取單個App版本號 **/
public String getAppVersion(String packageName) throws NameNotFoundException {
PackageInfo packageInfo = pManager.getPackageInfo(packageName, 0);
String appVersion = packageInfo.versionName;
return appVersion;
}
/** 獲取單個App的所有權限 **/
public String[] getAppPermission(String packageName) throws NameNotFoundException {
PackageInfo packageInfo = pManager.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
String[] permission = packageInfo.requestedPermissions;
return permission;
}
/** 獲取單個App的簽名 **/
public String getAppSignature(String packageName) throws NameNotFoundException {
PackageInfo packageInfo = pManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
String allSignature = packageInfo.signatures[0].toCharsString();
return allSignature;
}
二、獲取Android版本信息
int currentVersion = android.os.Build.VERSION.SDK_INT;
VERSION.SDK_INT--------->19 VERSION.SDK--------->19 VERSION.CODENAME--------->REL VERSION.INCREMENTAL--------->5.8.27 VERSION.RELEASE--------->4.4.4 VERSION_CODES.JELLY_BEAN--------->16 BOARD--------->MSM8974 BOOTLOADER--------->unknown BRAND--------->Xiaomi CPU_ABI--------->armeabi-v7a CPU_ABI2--------->armeabi DEVICE--------->cancro DISPLAY--------->KTU84P FINGERPRINT--------->Xiaomi/cancro_wc_lte/cancro:4.4.4/KTU84P/5.8.27:user/release-keys HARDWARE--------->qcom HOST--------->qh-miui-ota-bd58 ID--------->KTU84P MANUFACTURER--------->Xiaomi MODEL--------->MI 4LTE PRODUCT--------->cancro_wc_lte RADIO--------->unknown SERIAL--------->a4a0d854 TAGS--------->release-keys TIME--------->1440624955000 TYPE--------->user UNKNOWN--------->unknown USER--------->builder getRadioVersion()--------->MPSS.DI.3.0-d354d78
版權聲明:本文為博主原創文章,未經博主允許不得轉載。
