@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
패키지 이름으로 애플리케이션을 열립니다.
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;
}
전체 참조
- GitHub: https://github.com/Cap-go/capacitor-intent-launcher/
- 문서: /docs/plugins/intent-launcher/
Using @capgo/capacitor-intent-launcher
앱을 사용하는 경우 Using @capgo/capacitor-intent-launcher 계획 대시보드 및 API 작업을 계획하고 싶다면 @API/__CAPGO_KEEP_1__-intent-launcher와 연결하세요. @capgo/capacitor-intent-launcher implementation detail in @capgo/capacitor-intent-launcher 에서 Getting Started implementation detail in Getting Started 에서 API 개요 implementation detail in API 개요 에서 소개 implementation detail in 소개 에서, 그리고 API 키 implementation detail in API 키 에서.