@capgo/capacitor-intent-launcher 사용하기
Android intent를 실행하고 Android 및 iOS에서 시스템 설정을 열 수 있는 Capacitor Intent Launcher Plugin입니다.
설치
bun add @capgo/capacitor-intent-launcher
bunx cap sync
bunx cap sync 플러그인의 네이티브 code를 네이티브 프로젝트에 복사합니다. 플러그인을 업그레이드할 때마다 다시 실행하세요.
가져오기
import { IntentLauncher } from '@capgo/capacitor-intent-launcher';
API 한눈에 보기
| 메서드 | 설명 |
|---|---|
startActivityAsync |
주어진 action에 대한 Android activity를 시작합니다. |
openIOSSettings |
iOS 설정 화면을 엽니다. |
openApplication |
패키지 이름으로 앱을 엽니다. |
getApplicationIconAsync |
앱 아이콘을 base64로 인코딩된 PNG 문자열로 가져옵니다. |
예시
startActivityAsync()
주어진 action에 대한 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의 구현 세부 사항에 대해서는, 시작하기 Getting Started의 구현 상세 내용은 API 개요 구현 세부 사항은 API 개요에서 소개 Introduction의 구현 상세 내용은, 그리고 API 키 API Keys의 구현 상세 내용은