メインコンテンツへスキップ
@capgo/capacitor-intent-launcher デバイス API オープンソース

インテントランチャー Capacitor プラグイン

Intent システムで Android Intent を起動し、システム設定を開いたり、他のアプリと連携できます

インストール

bun add @capgo/capacitor-intent-launcher bunx cap sync
npm、pnpm、または yarn
  • npm install @capgo/capacitor-intent-launcher
  • pnpm add @capgo/capacitor-intent-launcher
  • yarn add @capgo/capacitor-intent-launcher

ガイド

Capacitor で Intent Launcher を使う方法

実機でテストする

Capgo アプリをダウンロードして、QR code をスキャンしてください。

Intent Launcher プラグインのプレビューQR code

@capgo/capacitor-intent-launcher の使用

Android と iOS の両方で Android の intent を起動し、システム設定を開くための Capacitor Intent Launcher プラグイン。

インストール

bun add @capgo/capacitor-intent-launcher
bunx cap sync

bunx cap sync プラグインのネイティブcodeをネイティブプロジェクトにコピーします。プラグインをアップグレードするたびに再度実行してください。

インポート

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

API の概要

メソッド 説明
startActivityAsync 指定したアクションで Android の Activity を開始します。
openIOSSettings iOS の設定画面を開きます。
openApplication パッケージ名を指定してアプリケーションを開きます。
getApplicationIconAsync アプリケーションのアイコンを base64 エンコードされた PNG 文字列として取得します。

例

startActivityAsync()

指定したアクションで Android の Activity を開始します。

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

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

// Open a specific app settings
const result = await IntentLauncher.startActivityAsync({
  action: ActivityAction.APPLICATION_DETAILS_SETTINGS,
  data: 'package:com.example.app'
});

openIOSSettings()

iOS の設定画面を開きます。

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

// Open app settings (recommended - 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 });

openApplication()

パッケージ名を指定してアプリケーションを開きます。

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

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

getApplicationIconAsync()

アプリケーションのアイコンを base64 エンコードされた PNG 文字列として取得します。

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

const { icon } = await IntentLauncher.getApplicationIconAsync({
  packageName: 'com.google.android.gm'
});
if (icon) {
  const img = document.createElement('img');
  img.src = icon;
}

完全なリファレンス

@capgo/capacitor-intent-launcher の使用から続けます

使用している場合 @capgo/capacitor-intent-launcher の使用 ダッシュボードと API の運用を計画するには、これを次と連携させます @capgo/capacitor-intent-launcher @capgo/capacitor-intent-launcher の実装詳細については、 スタートガイド スタートガイドの実装詳細については、 API の概要 「API の概要」の実装の詳細については、 はじめに はじめにの実装詳細、および API キー API Keys の実装詳細については、

よくある質問

Intent Launcher プラグイン FAQ

Capacitor アプリに Intent Launcher プラグインをインストールするにはどうすればよいですか?

"bun add @capgo/capacitor-intent-launcher"(または "npm install @capgo/capacitor-intent-launcher")を実行し、続けて "bunx cap sync" を実行すると、iOS と Android プロジェクトにネイティブの code が反映されます。あとはアプリの code で "@capgo/capacitor-intent-launcher" からインポートしてください。

@capgo/capacitor-intent-launcher は React、Vue、Angular で動作しますか?

はい。Intent Launcher は Capacitor パッケージなので、Ionic、React、Vue、Angular、Svelte、素の JavaScript など、Capacitor 上で動くあらゆる Web フレームワークで使えます。

@capgo/capacitor-intent-launcher はどの Capacitor バージョンをサポートしていますか?

Capgo プラグインは Capacitor のメジャーバージョンに合わせています。使用している Capacitor のメジャーバージョンに一致するプラグインのメジャーバージョンを使ってください (例: Capacitor 8 ならプラグイン v8)。GitHub の README にある互換性テーブルに、メンテナンス中のバージョンが記載されています。

@capgo/capacitor-intent-launcher は無料でオープンソースですか?

はい。code のソースコードは GitHub の https://github.com/Cap-go/capacitor-intent-launcher/ で公開されており、パッケージは npm から無料でインストールできます。バグ報告やプルリクエストも歓迎です。

App Store の審査なしで、Intent Launcher を使っている code をアップデートできますか?

プラグインのインストールやアップグレードはネイティブの code を変更するため、新しいストアビルドが必要です。その後は、プラグインを呼び出す JavaScript、HTML、CSS の変更を Capgo Live Updates で即座に配信できます。

アプリのレビューを待たずに Intent Launcher の変更をリリース

プラグインをストア用ビルドに組み込めば、Capgo live updates で JavaScript、HTML、CSS の変更を数分でユーザーに配信できます

Capgo から始める