@capgo/capacitor-intent-launcher

中文文档
8.3.41发布于 2026/10/26MPL-2.0TypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 5万

Capacitor plugin to launch Android intents and open system settings screens on Android and iOS.

原始使用文档
文档目录26 节
  1. ➡️ Get started for free
  2. Key features
  3. Why Capacitor Intent Launcher?
  4. Documentation
  5. Compatibility
  6. Install
  7. Android
  8. Opening Android Settings Screens
  9. Opening App-Specific Settings
  10. Launching Other Apps
  11. Advanced Intent Options
  12. Handling Activity Results
  13. Common Use Cases
  14. Android Version Compatibility
  15. Error Handling
  16. iOS
  17. Web
  18. API
  19. startActivityAsync(...)
  20. openIOSSettings(...)
  21. openApplication(...)
  22. getApplicationIconAsync(...)
  23. getPluginVersion()
  24. Interfaces
  25. Type Aliases
  26. Enums

@capgo/capacitor-intent-launcher

Launch Android intents and open system settings screens from your Capacitor app, and open iOS settings pages. Send users straight to the setting they need to change.

Capgo - Build Capacitor apps with AI, ship updates instantly

Capgo: push fixes to your Capacitor users in minutes, build signed iOS and Android apps without a Mac, and roll back in one click.

➡️ Get started for free

14-day unlimited free trial. No credit card required

🤖 Building with an AI coding agent? Install Capgo skills so Claude Code, Codex, Cursor, Copilot, or Gemini CLI know how to install and use @capgo/capacitor-intent-launcher in your Capacitor app: npx skills add Cap-go/capgo-skills. Then ask your agent: "Add @capgo/capacitor-intent-launcher to my Capacitor app and wire it up." Agent setup guides · Hosted MCP

@capgo/capacitor-intent-launcher for Capacitor apps

Key features

  • Android intents: startActivityAsync() starts any activity with action, data, extras and flags, and returns the result.
  • iOS settings: openIOSSettings() opens a settings screen.
  • Open apps: openApplication() launches another app by package name on Android.
  • App icons: getApplicationIconAsync() returns an installed app's icon as base64 on Android.
  • Platforms: iOS and Android. Not available on web.

Why Capacitor Intent Launcher?

A simple, free, and lightweight intent launcher plugin for both Android and iOS:

  • System settings access - Open any Android settings screen (WiFi, Bluetooth, Location, etc.) or iOS settings screens
  • iOS settings support - Open iOS settings screens including app settings, WiFi, Bluetooth, notifications, and more
  • App launching - Open any installed application by package name (Android)
  • App icon retrieval - Get application icons as base64-encoded images (Android)
  • Full intent support - Pass extras, flags, data URIs, and MIME types (Android)
  • Activity results - Receive result codes and data from launched activities (Android)
  • Zero dependencies - Minimal footprint, no bloat

Perfect for apps that need to guide users to system settings on both platforms.

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/intent-launcher/

Compatibility

Plugin versionCapacitor compatibilityMaintained
v8.*.*v8.*.*✅
v7.*.*v7.*.*On demand
v6.*.*v6.*.*❌
v5.*.*v5.*.*❌

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

Install

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

npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-intent-launcher` 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 @capgo/capacitor-intent-launcher
npx cap sync

Android

Works out of the box. No additional configuration required.

Opening Android Settings Screens

The plugin provides access to all Android system settings screens through the ActivityAction enum. Here are common examples:

import { IntentLauncher, ActivityAction } from '@capgo/capacitor-intent-launcher';

// Open main settings screen
await IntentLauncher.startActivityAsync({
  action: ActivityAction.SETTINGS
});

// Open WiFi settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.WIFI_SETTINGS
});

// Open Bluetooth settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.BLUETOOTH_SETTINGS
});

// Open Location settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.LOCATION_SOURCE_SETTINGS
});

// Open Display settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.DISPLAY_SETTINGS
});

// Open Sound settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.SOUND_SETTINGS
});

// Open Notification settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.NOTIFICATION_SETTINGS
});

Opening App-Specific Settings

You can open settings for a specific app by passing the package name:

// Open your app's settings page
await IntentLauncher.startActivityAsync({
  action: ActivityAction.APPLICATION_DETAILS_SETTINGS,
  data: 'package:com.yourapp.package'
});

// Open notification settings for your app
await IntentLauncher.startActivityAsync({
  action: ActivityAction.APP_NOTIFICATION_SETTINGS,
  extra: {
    'android.provider.extra.APP_PACKAGE': 'com.yourapp.package'
  }
});

Launching Other Apps

// Open an app by package name
await IntentLauncher.openApplication({
  packageName: 'com.google.android.gm' // Gmail
});

// Get an app's icon
const { icon } = await IntentLauncher.getApplicationIconAsync({
  packageName: 'com.google.android.gm'
});
// icon is a base64-encoded PNG: 'data:image/png;base64,...'

Advanced Intent Options

You can pass additional options like extras, flags, and MIME types:

// Open a content picker
await IntentLauncher.startActivityAsync({
  action: ActivityAction.GET_CONTENT,
  type: 'image/*',  // MIME type
  category: 'android.intent.category.OPENABLE'
});

// Open a URL in the browser
await IntentLauncher.startActivityAsync({
  action: ActivityAction.VIEW,
  data: 'https://example.com'
});

// Send text to another app
await IntentLauncher.startActivityAsync({
  action: ActivityAction.SEND,
  type: 'text/plain',
  extra: {
    'android.intent.extra.TEXT': 'Hello World!'
  }
});

// Make a phone call (requires CALL_PHONE permission)
await IntentLauncher.startActivityAsync({
  action: ActivityAction.CALL,
  data: 'tel:+1234567890'
});

// Open the dialer with a number (no permission required)
await IntentLauncher.startActivityAsync({
  action: ActivityAction.DIAL,
  data: 'tel:+1234567890'
});

Handling Activity Results

The startActivityAsync method returns a result with status information:

const result = await IntentLauncher.startActivityAsync({
  action: ActivityAction.LOCATION_SOURCE_SETTINGS
});

console.log('Result code:', result.resultCode);
// resultCode: -1 = Success, 0 = Canceled, 1+ = Custom user codes

if (result.data) {
  console.log('Data URI:', result.data);
}

if (result.extra) {
  console.log('Extra data:', result.extra);
}

Common Use Cases

Guide users to enable permissions:

// Location permission
await IntentLauncher.startActivityAsync({
  action: ActivityAction.LOCATION_SOURCE_SETTINGS
});

// Battery optimization settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.IGNORE_BATTERY_OPTIMIZATION_SETTINGS
});

// Overlay permission (draw over other apps)
await IntentLauncher.startActivityAsync({
  action: ActivityAction.MANAGE_OVERLAY_PERMISSION,
  data: 'package:com.yourapp.package'
});

Network settings:

// WiFi settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.WIFI_SETTINGS
});

// Mobile data settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.DATA_USAGE_SETTINGS
});

// Airplane mode settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.AIRPLANE_MODE_SETTINGS
});

Security settings:

// Biometric enrollment
await IntentLauncher.startActivityAsync({
  action: ActivityAction.BIOMETRIC_ENROLL
});

// Fingerprint settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.FINGERPRINT_SETTINGS
});

// Security settings
await IntentLauncher.startActivityAsync({
  action: ActivityAction.SECURITY_SETTINGS
});

Android Version Compatibility

Some settings actions are only available on specific Android versions. The plugin includes platform version information in the ActivityAction enum comments (e.g., @platform Android 12+). If you use an action that's not available on the device's Android version, the intent may fail or fall back to a general settings screen.

Error Handling

Always wrap intent calls in try-catch blocks:

try {
  await IntentLauncher.startActivityAsync({
    action: ActivityAction.WIFI_SETTINGS
  });
} catch (error) {
  console.error('Failed to open settings:', error);
  // Handle error - e.g., show a message to the user
}

iOS

Works out of the box. Use the openIOSSettings() method to open iOS settings screens.

Important: The only officially supported option by Apple is IOSSettings.App which opens your app's settings page. Other options use undocumented URL schemes (App-prefs:) that may break in future iOS versions or could potentially cause App Store rejection.

Note: The iOS Simulator will sometimes only open the Settings app, instead of the specified option. Test on a real device for accurate behavior.

import { IntentLauncher, IOSSettings } from '@capgo/capacitor-intent-launcher';

// Open app settings (officially supported by Apple)
await IntentLauncher.openIOSSettings({ option: IOSSettings.App });

// Open WiFi settings (may not work in all iOS versions)
await IntentLauncher.openIOSSettings({ option: IOSSettings.WiFi });

Web

Not supported. This plugin uses native platform APIs.

API

Capacitor Intent Launcher Plugin for launching Android intents and opening system settings on both Android and iOS.

startActivityAsync(...)

startActivityAsync(options: IntentLauncherParams) => Promise<IntentLauncherResult>

Starts an Android activity for the given action.

ParamTypeDescription
optionsIntentLauncherParams- The intent launch options including action and optional parameters

Returns: Promise<IntentLauncherResult>

Since: 1.0.0


openIOSSettings(...)

openIOSSettings(options: IOSSettingsParams) => Promise<IOSSettingsResult>

Opens iOS settings screen.

Note: The only officially supported option by Apple is App which opens your app's settings page. Other options may work but are not guaranteed and could break in future iOS versions or cause App Store rejection.

Also note that the iOS Simulator will sometimes only open the Settings app, instead of the specified option.

ParamTypeDescription
optionsIOSSettingsParams- The iOS settings option to open

Returns: Promise<IOSSettingsResult>

Since: 8.2.0


openApplication(...)

openApplication(options: OpenApplicationOptions) => Promise<void>

Opens an application by its package name.

ParamTypeDescription
optionsOpenApplicationOptions- The package name of the application to open

Since: 1.0.0


getApplicationIconAsync(...)

getApplicationIconAsync(options: GetApplicationIconOptions) => Promise<GetApplicationIconResult>

Gets the application icon as a base64-encoded PNG string.

ParamTypeDescription
optionsGetApplicationIconOptions- The package name of the application

Returns: Promise<GetApplicationIconResult>

Since: 1.0.0


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the native Capacitor plugin version.

Returns: Promise<{ version: string; }>

Since: 1.0.0


Interfaces

IntentLauncherResult

Result from starting an activity.

PropTypeDescriptionSince
resultCodeResultCodeThe result code returned by the activity.1.0.0
datastringOptional data URI returned by the activity.1.0.0
extraRecord<string, unknown>Optional extra data returned by the activity.1.0.0

IntentLauncherParams

Options for starting an activity.

PropTypeDescriptionSince
actionstringThe action to perform. Use values from ActivityAction enum.1.0.0
categorystringOptional category to add to the intent.1.0.0
classNamestringOptional class name for the component to launch.1.0.0
datastringOptional URI data for the intent. Must be a valid URI.1.0.0
extraRecord<string, unknown>Optional extra data to pass to the intent as key-value pairs.1.0.0
flagsnumberOptional intent flags as a bitmask.1.0.0
packageNamestringOptional package name for the component.1.0.0
typestringOptional MIME type for the intent data.1.0.0

IOSSettingsResult

Result from opening iOS settings.

PropTypeDescriptionSince
successbooleanWhether the settings screen was successfully opened.8.2.0

IOSSettingsParams

Options for opening iOS settings.

PropTypeDescriptionSince
optionstringThe iOS settings screen to open. Use values from IOSSettings enum.8.2.0

OpenApplicationOptions

Options for opening an application.

PropTypeDescriptionSince
packageNamestringThe package name of the application to open.1.0.0

GetApplicationIconResult

Result from getting an application icon.

PropTypeDescriptionSince
iconstringThe application icon as a base64-encoded PNG string prefixed with 'data:image/png;base64,'. Empty string if the icon is not available.1.0.0

GetApplicationIconOptions

Options for getting an application icon.

PropTypeDescriptionSince
packageNamestringThe package name of the application.1.0.0

Type Aliases

Record

Construct a type with a set of properties K of type T

{ [P in K]: T; }

Enums

ResultCode

MembersValueDescription
Success-1The activity completed successfully.
Canceled0The activity was canceled by the user.
FirstUser1First custom user-defined result code.

Credit

Based on the (Expo plugin)[https://docs.expo.dev/versions/latest/sdk/intent-launcher/]

版本与发布记录

@capgo/capacitor-intent-launcher 共发布 43 个版本,首次发布于 2026/01/05;过去 12 个月发布了 43 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.3.41latest2026/10/2613 天前
8.3.402026/10/1920 天前
8.3.392026/10/1525 天前
8.3.382026/10/1327 天前
8.3.372026/10/1228 天前
8.3.362026/10/091 个月前

关于 @capgo/capacitor-intent-launcher 的常见问题

@capgo/capacitor-intent-launcher 是什么?

Capacitor plugin to launch Android intents and open system settings screens on Android and iOS.

如何安装 @capgo/capacitor-intent-launcher?

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

@capgo/capacitor-intent-launcher 支持 TypeScript 吗?

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

@capgo/capacitor-intent-launcher 支持 ESM 还是 CommonJS?

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

@capgo/capacitor-intent-launcher 可以商用吗?

@capgo/capacitor-intent-launcher 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@capgo/capacitor-intent-launcher 的下载量有多少?

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

@capgo/capacitor-intent-launcher 还在维护吗?

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