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;
}