@capgo/capacitor-intent-launcher を使用します
Capacitor の Intent Launcher プラグインは、Android と iOS の両方で Android インテントを起動し、システム設定を開くために使用されます。
インストール
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
__CAPGO_KEEP_0__アプリを開きます。
import { IntentLauncher } from '@capgo/capacitor-intent-launcher';
// Open Gmail app
await IntentLauncher.openApplication({ packageName: 'com.google.android.gm' });
getApplicationIconAsync
__CAPGO_KEEP_0__アプリのアイコンを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;
}
フルリファレンス
- GitHub https://github.com/Cap-go/capacitor-intent-launcher/
- /docs/plugins/intent-launcher/
Using @capgo/capacitor-intent-launcher
__CAPGO_KEEP_0__を使用している場合 Capgoを使用して、capacitor-intent-launcherを使用して、ダッシュボードとcapgoのオペレーションを計画する APIと接続してください。 @capgo/capacitor-intent-launcher @capgo/capacitor-intent-launcherの実装詳細について Getting Started @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-intent-launcherの実装詳細について APIの概要 @API/__CAPGO_KEEP_1__-intent-launcherの実装詳細について 導入 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-intent-launcherの実装詳細について APIのキー @API/__CAPGO_KEEP_1__-intent-launcherの実装詳細について