An open API service indexing awesome lists of open source software.

https://github.com/capawesome-team/capacitor-managed-configurations

⚡️ Capacitor plugin to access managed configuration settings.
https://github.com/capawesome-team/capacitor-managed-configurations

List: capacitor-managed-configurations

android capacitor capacitor-android capacitor-ios capacitor-plugin capawesome ios managed-configurations mdm

Last synced: 2 months ago
JSON representation

⚡️ Capacitor plugin to access managed configuration settings.

Awesome Lists containing this project

README

        

## ⚠️ Deprecated repository

**This project has been moved to the following monorepo: [capawesome-team/capacitor-plugins](https://github.com/capawesome-team/capacitor-plugins).**

-----



Managed Configuration


@capawesome/capacitor-managed-configurations



Capacitor plugin to access managed configuration settings.










## Maintainers

| Maintainer | GitHub | Social |
| ---------- | ----------------------------------------- | --------------------------------------------- |
| Robin Genz | [robingenz](https://github.com/robingenz) | [@robin_genz](https://twitter.com/robin_genz) |

## Sponsors

This is an MIT-licensed open source project.
It can grow thanks to the support by these awesome people.
If you'd like to join them, please read more [here](https://github.com/sponsors/capawesome-team).

## Installation

```bash
npm install @capawesome/capacitor-managed-configurations
npx cap sync
```

On **Android**, see [Define managed configurations](https://developer.android.com/work/managed-configurations#define-configuration) and follow the instructions to declare the app's managed configurations correctly.

## Configuration

No configuration required for this plugin.

## Demo

A working example can be found here: [robingenz/capacitor-plugin-demo](https://github.com/robingenz/capacitor-plugin-demo)

## Usage

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

## API

* [`getString(...)`](#getstring)
* [`getNumber(...)`](#getnumber)
* [`getBoolean(...)`](#getboolean)
* [Interfaces](#interfaces)

### getString(...)

```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 for Android and iOS.

| Param | Type |
| ------------- | ------------------------------------------------- |
| **`options`** | GetOptions |

**Returns:** Promise<GetResult<string>>

--------------------

### getNumber(...)

```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 for Android and iOS.

| Param | Type |
| ------------- | ------------------------------------------------- |
| **`options`** | GetOptions |

**Returns:** Promise<GetResult<number>>

--------------------

### getBoolean(...)

```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 for Android and iOS.

| Param | Type |
| ------------- | ------------------------------------------------- |
| **`options`** | GetOptions |

**Returns:** Promise<GetResult<boolean>>

--------------------

### Interfaces

#### 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. |

## Test your implementation

On **Android**, see [Set up device owner for testing](https://source.android.com/devices/tech/admin/testing-setup#set_up_the_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](https://support.apple.com/de-de/guide/deployment-reference-ios/iorf4d72eded/web) with a MDM solution.

## Changelog

See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-managed-configurations/blob/master/CHANGELOG.md).

## License

See [LICENSE](https://github.com/capawesome-team/capacitor-managed-configurations/blob/master/LICENSE).