Skip to content

Instantly share code, notes, and snippets.

@billynyh
Created August 28, 2012 07:30
Show Gist options
  • Save billynyh/3495860 to your computer and use it in GitHub Desktop.
Save billynyh/3495860 to your computer and use it in GitHub Desktop.
read android app meta-data
// get meta-data from AndroidManifest.xml
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
String meta = ai.metaData.getString("key");
// get version name and version code
PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
String versionName = pinfo.versionName;
int versionCode = pinfo.versionCode;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment