Android examples for App:Manifest
get meta data from manifest
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; public class Main { /**//from ww w. ja v a2 s . c o m * get meta data from manifest * * @param context * @param key key * @return value */ public static String getMetadata(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; } /** * get package name */ public static String getPackageName(Context context) { try { return context.getPackageManager().getPackageInfo( context.getPackageName(), 0).packageName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return null; } }