Capacitor plugin to access managed configuration settings.
npm install @capawesome/capacitor-managed-configurationsCapacitor plugin to access managed configuration settings.
| Plugin Version | Capacitor Version | Status |
| -------------- | ----------------- | -------------- |
| 8.x.x | >=8.x.x | Active support |
| 7.x.x | 7.x.x | Deprecated |
| 6.x.x | 6.x.x | Deprecated |
| 5.x.x | 5.x.x | Deprecated |
``bash`
npm install @capawesome/capacitor-managed-configurations
npx cap sync
See Define managed configurations and follow the instructions to declare the app's managed configurations correctly.
No configuration required for this plugin.
A working example can be found here: robingenz/capacitor-plugin-demo
`typescript
import { ManagedConfigurations } from '@capawesome/capacitor-managed-configurations';
const getString = async () => {
const result = await ManagedConfigurations.getString({ key: 'server_url' });
return result.value;
};
const getNumber = async () => {
const result = await ManagedConfigurations.getNumber({ key: 'server_port' });
return result.value;
};
const getBoolean = async () => {
const result = await ManagedConfigurations.getBoolean({
key: 'download_on_cellular',
});
return result.value;
};
`
* getString(...)
* getNumber(...)
* getBoolean(...)
* Interfaces
`typescript`
getString(options: GetOptions) => Promise
Fetches the value associated with the given key, or null if no mapping exists for the given key.
Only available on Android and iOS.
| Param | Type |
| ------------- | ------------------------------------------------- |
| options | GetOptions |
Returns: Promise<GetResult<string>>
--------------------
`typescript`
getNumber(options: GetOptions) => Promise
Fetches the value associated with the given key, or null if no mapping exists for the given key.
Only available on Android and iOS.
| Param | Type |
| ------------- | ------------------------------------------------- |
| options | GetOptions |
Returns: Promise<GetResult<number>>
--------------------
`typescript`
getBoolean(options: GetOptions) => Promise
Fetches the value associated with the given key, or null if no mapping exists for the given key.
Only available on Android and iOS.
| Param | Type |
| ------------- | ------------------------------------------------- |
| options | GetOptions |
Returns: Promise<GetResult<boolean>>
--------------------
#### GetResult
| Prop | Type | Description |
| ----------- | ---------------------- | --------------------------------------------------------------------------------------- |
| value | T \| null | The value of the configuration entry, or null if no mapping exists for the given key. |
#### GetOptions
| Prop | Type | Description |
| --------- | ------------------- | --------------------------------------- |
| key` | string | Unique key for the configuration entry. |
On Android, see Set up device owner for testing and follow the instructions to set up a device owner testing environment.
On iOS, you need to install the app as a managed app with a MDM solution.
See CHANGELOG.md.
See LICENSE.
This plugin is based on the Capacitor Managed Configurations plugin.
Thanks to everyone who contributed to the project!