@capawesome/capacitor-android-intent-launcher

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

Capacitor plugin to launch arbitrary Android intents.

原始使用文档
文档目录29 节
  1. Features
  2. Use Cases
  3. Compatibility
  4. Installation
  5. Android
  6. iOS
  7. Configuration
  8. Usage
  9. Start an activity
  10. Check whether an intent can be resolved
  11. API
  12. canResolveActivity(...)
  13. startActivity(...)
  14. Interfaces
  15. Type Aliases
  16. Common Intents
  17. Package Visibility
  18. FAQ
  19. How is this plugin different from other similar plugins?
  20. Why does startActivity reject with the error code ACTIVITY_…
  21. Does this plugin work on iOS or Web?
  22. When should I use this plugin instead of a dedicated plugin?
  23. Can I pass complex data as intent extras?
  24. How do I know whether the launched activity was successful?
  25. Can I use this plugin with Ionic, React, Vue or Angular?
  26. Related Plugins
  27. Newsletter
  28. Changelog
  29. License

Capacitor Android Intent Launcher Plugin

Capacitor plugin to launch arbitrary Android intents.

Features

  • 🚀 Start activities: Launch any Android activity via a custom intent and read its result.
  • 🔍 Resolve activities: Check whether an activity can handle an intent before launching it.
  • 🎯 Explicit & implicit intents: Target a specific component or let the system pick a handler.
  • 📦 Extras & flags: Attach primitive extras and intent flags.
  • 🤝 Compatibility: Works alongside the Settings Launcher and App Launcher plugins.
  • 🔁 Up-to-date: Always supports the latest Capacitor version.

Missing a feature? Just open an issue and we'll take a look!

Use Cases

The Android Intent Launcher plugin is typically used whenever an app needs to interact with system screens or other apps that no dedicated plugin covers, for example:

  • Opening system screens: Open Android system screens such as the app settings screen via the android.settings.APPLICATION_DETAILS_SETTINGS action.
  • Integrating with other apps: Launch a specific activity of another app via an explicit intent and read its result code and result data once it finishes.
  • Sharing and composing: Share plain text via the android.intent.action.SEND action or compose an email via the android.intent.action.SENDTO action.
  • Feature detection: Check whether an activity exists that can handle an intent before launching it, for example to conditionally show a button in your UI.

Compatibility

Plugin VersionCapacitor VersionStatus
0.x.x>=8.x.xActive support

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-android-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 @capawesome/capacitor-android-intent-launcher
npx cap sync

This plugin is only available on Android. On iOS and Web, all methods reject as unimplemented.

Android

No additional configuration is required for this plugin.

However, on Android 11 (API level 30) and higher, package visibility restricts which apps and intents your app can see. To launch or resolve intents that target other apps, you may need to declare matching <queries> entries in your app's AndroidManifest.xml. See Package visibility below.

iOS

This plugin has no iOS implementation. Intents are an Android-only concept. All methods reject as unimplemented on iOS.

Configuration

No configuration required for this plugin.

Usage

The following examples show how to start an activity for an intent and check whether an intent can be resolved.

Start an activity

Launch an activity for the given intent. The intent is started via the startActivityForResult(...) API, so the result code and result data of the launched activity are returned once it finishes. Only available on Android:

import { AndroidIntentLauncher } from '@capawesome/capacitor-android-intent-launcher';

const startActivity = async () => {
  const { resultCode } = await AndroidIntentLauncher.startActivity({
    action: 'android.intent.action.VIEW',
    dataUri: 'https://capawesome.io',
  });
  return resultCode;
};

Check whether an intent can be resolved

Check whether an activity exists that can handle the given intent before launching it. On Android 11 (API level 30) and higher, the result is affected by package visibility. Only available on Android:

import { AndroidIntentLauncher } from '@capawesome/capacitor-android-intent-launcher';

const canResolveActivity = async () => {
  const { canResolve } = await AndroidIntentLauncher.canResolveActivity({
    action: 'android.intent.action.VIEW',
    dataUri: 'https://capawesome.io',
  });
  return canResolve;
};

API

canResolveActivity(...)

canResolveActivity(options: CanResolveActivityOptions) => Promise<CanResolveActivityResult>

Check whether an activity exists that can handle the given intent.

This is a wrapper around the PackageManager.resolveActivity(...) API.

On Android 11 (API level 30) and higher, the result is affected by package visibility. Your app may need to declare matching &lt;queries&gt; entries in its AndroidManifest.xml for the intent to be resolved.

Only available on Android.

ParamType
optionsStartActivityOptions

Returns: Promise<CanResolveActivityResult>

Since: 0.1.0


startActivity(...)

startActivity(options: StartActivityOptions) => Promise<StartActivityResult>

Launch an activity for the given intent.

The intent is started via the startActivityForResult(...) API so the result code and result data of the launched activity are returned once it finishes.

This is the power-user escape hatch for system screens and app integrations that no dedicated plugin covers. Prefer a typed plugin (such as Settings Launcher or App Launcher) where one exists.

Only available on Android.

ParamType
optionsStartActivityOptions

Returns: Promise<StartActivityResult>

Since: 0.1.0


Interfaces

CanResolveActivityResult

PropTypeDescriptionSince
canResolvebooleanWhether or not an activity exists that can handle the intent.0.1.0

StartActivityOptions

PropTypeDescriptionSince
actionstringThe action of the intent.0.1.0
categoriesstring[]The categories to add to the intent.0.1.0
classNamestringThe fully qualified class name of the component to launch. Must be used together with the packageName property to create an explicit intent that targets a specific component.0.1.0
dataUristringThe data URI of the intent.0.1.0
extras{ [key: string]: string | number | boolean; }The extras to add to the intent. Only primitive values (string, number and boolean) are supported.0.1.0
flagsnumberThe flags to add to the intent. Multiple flags can be combined using the bitwise OR operator.0.1.0
packageNamestringThe package name of the component to launch. If used without the className property, the intent is restricted to the given package. If used together with the className property, an explicit intent that targets a specific component is created.0.1.0
typestringThe MIME type of the intent data.0.1.0

StartActivityResult

PropTypeDescriptionSince
dataUristring | nullThe data URI returned by the launched activity.0.1.0
resultCodenumberThe result code returned by the launched activity. The value is -1 if the activity finished successfully (RESULT_OK), 0 if it was canceled (RESULT_CANCELED) or any other custom result code set by the launched activity.0.1.0

Type Aliases

CanResolveActivityOptions

StartActivityOptions

Common Intents

The following table lists a few common intents to get you started. See the Android documentation for the full list of actions, categories, extras and flags.

Use caseactiondataUritypeextras
Open a websiteandroid.intent.action.VIEWhttps://capawesome.io––
Open the dialerandroid.intent.action.DIALtel:+12025550123––
Compose an emailandroid.intent.action.SENDTOmailto:[email protected]–{ 'android.intent.extra.SUBJECT': 'Hi' }
Share plain textandroid.intent.action.SEND–text/plain{ 'android.intent.extra.TEXT': 'Hello world!' }
Open app settingsandroid.settings.APPLICATION_DETAILS_SETTINGSpackage:com.example.app––

This plugin is intended as a last resort for system screens and app integrations that no dedicated plugin covers. Prefer a typed plugin where one exists — for example Settings Launcher for system settings screens or App Launcher for opening URLs and other apps.

Package Visibility

On Android 11 (API level 30) and higher, package visibility limits which other apps your app can interact with. This affects both startActivity(...) (an unresolvable intent rejects with the error code ACTIVITY_NOT_FOUND) and canResolveActivity(...) (which returns false for intents your app cannot see).

If you launch or resolve intents that target other apps, declare the intents you query in your app's AndroidManifest.xml. The plugin cannot predeclare arbitrary intents on your behalf.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="https" />
    </intent>
  </queries>
</manifest>

FAQ

How is this plugin different from other similar plugins?

It launches arbitrary Android intents — explicit or implicit — so you can open system screens or hand off to other apps even when no dedicated plugin covers them, and read the activity result back. You can attach primitive extras and intent flags, and resolve whether an activity can handle an intent before launching it, all through a fully typed API kept current with the latest Capacitor version. When a focused plugin already exists for your target, such as Settings Launcher or App Launcher, that is a fine choice; when you need full control over the raw intent, this plugin is built for it.

Why does startActivity reject with the error code ACTIVITY_NOT_FOUND?

This happens when no activity exists that can handle the given intent. On Android 11 (API level 30) and higher, this can also be caused by package visibility, which limits which other apps your app can see. In that case, declare the intents you query in your app's AndroidManifest.xml using <queries> entries.

Does this plugin work on iOS or Web?

No, intents are an Android-only concept, so this plugin has no iOS or Web implementation. On iOS and Web, all methods reject as unimplemented.

When should I use this plugin instead of a dedicated plugin?

This plugin is intended as a last resort for system screens and app integrations that no dedicated plugin covers. Prefer a typed plugin where one exists, for example Settings Launcher for system settings screens or App Launcher for opening URLs and other apps.

Can I pass complex data as intent extras?

No, only primitive values (string, number and boolean) are supported as intent extras. Intent flags can be attached as well and multiple flags can be combined using the bitwise OR operator.

How do I know whether the launched activity was successful?

The startActivity(...) method resolves with the result code returned by the launched activity once it finishes. The value is -1 if the activity finished successfully (RESULT_OK), 0 if it was canceled (RESULT_CANCELED), or any other custom result code set by the launched activity.

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.

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.

版本与发布记录

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

版本发布日期距今
0.1.2latest2026/09/022 个月前
0.1.12026/07/153 个月前
0.1.02026/07/143 个月前
0.0.12026/07/084 个月前

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

@capawesome/capacitor-android-intent-launcher 是什么?

Capacitor plugin to launch arbitrary Android intents.

如何安装 @capawesome/capacitor-android-intent-launcher?

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

@capawesome/capacitor-android-intent-launcher 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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