Android-manifest里读配置文件metaData

例子:

manifest里面有

<meta-data
android:name="ip"
android:value="192.168.0.1" />

 

/**
* read service configuration from app manifest file
*/
private String readConfiguration(Context applicationContext) {

String appPackageName = applicationContext.getPackageName();
ApplicationInfo ai = applicationContext.getPackageManager().getApplicationInfo(appPackageName, PackageManager.GET_META_DATA);
Bundle metaData = ai.metaData;

String ip = metaData.getString("ip");

return ip;

}

 

posted on 2014-05-29 11:07  lancyWang  阅读(236)  评论(0编辑  收藏  举报

导航