例子:android
manifest裏面有app
<meta-data
android:name="ip"
android:value="192.168.0.1" />ip
/**
* 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;get
String ip = metaData.getString("ip");io
return ip;file
}service