0.2.0 • Published 6 years ago
cordova-plugin-app-config v0.2.0
cordova-plugin-app-config
It reads Info.plist or AndroidManifest.xml.
Examples
iOS:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>MyApiKey</key>
<string>ef8b97cce42d</string>
<key>FacebookAppID</key>
<string>4157893254</string>
</dict>
</plist>
Android:
<?xml version='1.0' encoding='utf-8'?>
<manifest ...>
...
<application ...>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 4157893254" />
<meta-data android:name="MyApiKey" android:value="ef8b97cce42d" />
</application>
</manifest>
Note: escaped space is used in "com.facebook.sdk.ApplicationId" to force value to string type.
Usage
iOS:
cordova.plugins.AppConfig.fetch(['MyApiKey', 'FacebookAppID'], function(result) {
console.log(result); // => { "MyApiKey": "ef8b97cce42d", "FacebookAppID": "4157893254" }
});
Android:
cordova.plugins.AppConfig.fetch(['MyApiKey', 'com.facebook.sdk.ApplicationId'], function(result) {
console.log(result); // => { "MyApiKey": "ef8b97cce42d", "com.facebook.sdk.ApplicationId": "4157893254" }
});
You can specify any fields you want. Only specified fields will be returned.
Publishing new version
- Update package.json
- Update plugin.xml
npm publish .