Android-manifest裏讀配置文件metaData

例子: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

相關文章
相關標籤/搜索