Skip to content

Commit

Permalink
增加获取application层级的metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Aug 1, 2017
1 parent 24df090 commit 0988e29
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,22 @@ public static String getPackageName(Context context) {
return null;
}

/**
* 获取application层级的metadata
*
* @param context 上下文
* @param key key
* @return value
*/
public static String getApplicationMetaData(Context context, String key) {
try {
Bundle metaData = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA).metaData;
return metaData.get(key).toString();
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return null;
}


}

0 comments on commit 0988e29

Please sign in to comment.