@capawesome/capacitor-managed-configurations

中文文档
8.0.2发布于 2026/09/02MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 4652

Capacitor plugin to access managed configuration settings on Android and iOS.

原始使用文档
文档目录27 节
  1. Use Cases
  2. Compatibility
  3. Installation
  4. Android
  5. Configuration
  6. Demo
  7. Usage
  8. Read managed configuration values
  9. API
  10. getString(...)
  11. getNumber(...)
  12. getBoolean(...)
  13. Interfaces
  14. Test your implementation
  15. FAQ
  16. What are managed configurations?
  17. Should I use this plugin or the Intune plugin?
  18. What happens if a configuration key does not exist?
  19. Do I need to declare the managed configurations in my app?
  20. How can I test managed configurations during development?
  21. Is the Web platform supported?
  22. Can I use this plugin with Ionic, React, Vue or Angular?
  23. Related Plugins
  24. Newsletter
  25. Changelog
  26. License
  27. Credits

Capacitor Managed Configurations Plugin

Capacitor plugin to access managed configuration settings.

Use Cases

The Managed Configurations plugin is typically used in enterprise apps that are distributed through an EMM or MDM solution, for example:

  • Preconfigured server settings: Read a server URL or port that the organization's IT department has configured, instead of asking the user to enter it.
  • Policy-driven features: Use boolean configuration entries to enable or disable features per deployment, such as allowing downloads on cellular connections.
  • Multi-tenant deployments: Ship a single app to multiple organizations and adapt it at runtime based on the managed configuration values of each tenant.

Compatibility

Plugin VersionCapacitor VersionStatus
8.x.x>=8.x.xActive support
7.x.x7.x.xDeprecated
6.x.x6.x.xDeprecated
5.x.x5.x.xDeprecated

Installation

You can use our AI-Assisted Setup to install the plugin. Add the Capawesome Skills to your AI tool using the following command:

npx skills add capawesome-team/skills --skill capacitor-plugins

Then use the following prompt:

 Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-managed-configurations` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

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

Android

See Define managed configurations 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

Usage

The following example shows how to read managed configuration values as strings, numbers, and booleans.

Read managed configuration values

Fetch the value associated with a given key as a string, number, or boolean. The result contains null if no mapping exists for the given key. These methods are only available on Android and iOS:

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(options: GetOptions) => Promise<GetResult<string>>

Fetches the value associated with the given key, or null if no mapping exists for the given key.

Only available on Android and iOS.

ParamType
optionsGetOptions

Returns: Promise<GetResult<string>>


getNumber(...)

getNumber(options: GetOptions) => Promise<GetResult<number>>

Fetches the value associated with the given key, or null if no mapping exists for the given key.

Only available on Android and iOS.

ParamType
optionsGetOptions

Returns: Promise<GetResult<number>>


getBoolean(...)

getBoolean(options: GetOptions) => Promise<GetResult<boolean>>

Fetches the value associated with the given key, or null if no mapping exists for the given key.

Only available on Android and iOS.

ParamType
optionsGetOptions

Returns: Promise<GetResult<boolean>>


Interfaces

GetResult

PropTypeDescription
valueT | nullThe value of the configuration entry, or null if no mapping exists for the given key.

GetOptions

PropTypeDescription
keystringUnique key for the configuration entry.

Test your implementation

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.

FAQ

What are managed configurations?

Managed configurations are settings that an organization's EMM or MDM solution pushes to an app, for example a server URL or a feature toggle. This plugin lets your Capacitor app read these settings at runtime using the getString, getNumber, and getBoolean methods.

Should I use this plugin or the Intune plugin?

Organizations can deliver app configuration through two different channels, and administrators frequently mix them up. This plugin covers the MDM channel; the Intune plugin covers the MAM channel:

MDM channel (this plugin)MAM channel (Intune)
Device enrollment requiredYesNo
Delivered viaRestrictionsManager / com.apple.configuration.managedIntune App SDK (Intune service)
Targeted atThe deviceThe signed-in account (identity)
EMM vendorAny EMM/MDM vendorMicrosoft Intune only
Typical scenarioCorporate-owned, fully managed devicesBYOD / app protection without device management

If your organization deploys the app configuration policy with "Managed devices" as the delivery channel in the Intune admin center, use this plugin. If it is deployed with "Managed apps", use the Intune plugin. Apps that must support both scenarios should read both channels.

What happens if a configuration key does not exist?

The getString, getNumber, and getBoolean methods return a result whose value is null if no mapping exists for the given key. Your app should handle this case, for example by falling back to a default value.

Do I need to declare the managed configurations in my app?

On Android, yes. You need to declare your app's managed configurations as described in Define managed configurations so that EMM solutions can discover and set them. See the Installation section for details.

How can I test managed configurations during development?

On Android, you can set up a device owner testing environment as described in Set up device owner for testing. On iOS, the app must be installed as a managed app through an MDM solution. See the Test your implementation section for details.

Is the Web platform supported?

No, the getString, getNumber, and getBoolean methods are only available on Android and iOS. Managed configurations are a concept of mobile device management, which does not exist in the browser.

Can I use this plugin with Ionic, React, Vue or Angular?

Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.

  • App Integrity: Verify app and device integrity using the Play Integrity API and App Attest.
  • Intune: Protect corporate data with Microsoft Intune Mobile Application Management (the MAM channel counterpart to this plugin).
  • Root Detection: Detect rooted and jailbroken devices.
  • Secure Preferences: Securely store key/value pairs such as passwords, tokens or other sensitive information.

Newsletter

Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our Capawesome Newsletter.

Changelog

See CHANGELOG.md.

License

See LICENSE.

Credits

This plugin is based on the Capacitor Managed Configurations plugin. Thanks to everyone who contributed to the project!

版本与发布记录

@capawesome/capacitor-managed-configurations 共发布 10 个版本,首次发布于 2022/08/05;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.0.2latest2026/09/022 个月前
8.0.12026/02/198 个月前
8.0.02025/12/1710 个月前
7.0.0-dev.1765885034dev2025/12/1610 个月前
7.0.12025/02/011.8 年前
7.0.02025/01/301.8 年前

关于 @capawesome/capacitor-managed-configurations 的常见问题

@capawesome/capacitor-managed-configurations 是什么?

Capacitor plugin to access managed configuration settings on Android and iOS.

如何安装 @capawesome/capacitor-managed-configurations?

在项目目录运行 npm install @capawesome/capacitor-managed-configurations,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(>=8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@capawesome/capacitor-managed-configurations 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@capawesome/capacitor-managed-configurations 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@capawesome/capacitor-managed-configurations 可以商用吗?

@capawesome/capacitor-managed-configurations 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@capawesome/capacitor-managed-configurations 的下载量有多少?

根据 npm 官方下载统计,@capawesome/capacitor-managed-configurations 在 2026/10/09 – 2026/11/07 这 30 天内被下载 4,652 次,日均约 155 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@capawesome/capacitor-managed-configurations 还在维护吗?

最新版本 8.0.2 发布于 2026/09/02(2 个月前);至今共发布 10 个版本,其中过去 12 个月发布了 4 个;首次发布于 2022/08/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。