读取第三方android应用的META值
2018-01-11 本文已影响14人
学习不断
//第三方android应用的META值
public String getPackageMetaValue(Context context, String packageName, String key) {
ApplicationInfo appInfo =null;
String value =null;
try {
appInfo = context.getPackageManager()
.getApplicationInfo(packageName,
PackageManager.GET_META_DATA);
value = String.valueOf(appInfo.metaData.get(key));
}catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return value;
}