メインコンテンツにジャンプ
プラグインに戻る
@capgo/capacitor-intent-launcher
チュートリアル
@capgo/capacitor-intent-launcher

意図実行プラグイン

Android インテントを起動、システム設定を開き、他のアプリと相互作用することができます。

ガイド

インテント ランチャーに関するチュートリアル

デバイスでテスト

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

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

@capgo/capacitor-intent-launcherを使用

CapacitorのAndroid インテントとiOS システム設定を開くためのIntent Launcher プラグイン

インストール

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

このプラグインが提供するもの

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

例の使用

startActivityAsync

Androidアクティビティを起動します。

import { IntentLauncher } 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 } 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を使用してダッシュボードと@capgoの作業を計画する @API/__CAPGO_KEEP_1__-intent-launcherを@API/__CAPGO_KEEP_1__-intent-launcherに接続する @capgo/capacitor-intent-launcherの実装詳細 for the implementation detail in @capgo/capacitor-intent-launcher, @__CAPGO_KEEP_0__ Overviewの実装詳細 Introductionの実装詳細 @API Keysの実装詳細 @API/__CAPGO_KEEP_1__-intent-launcherを使用してダッシュボードと@APIの作業を計画する @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-intent-launcherを@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-intent-launcherに接続する @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-intent-launcherの実装詳細 API Keys APIの実装詳細については、APIキーの詳細を参照してください。