콘텐츠로 건너뛰기

시작하기

  1. 패키지 설치

    Terminal window
    npm i @capgo/native-market
  2. 네이티브 프로젝트와 동기화

    Terminal window
    npx cap sync

플러그인을 가져와서 메서드를 사용하여 사용자를 앱 스토어로 리디렉션하세요:

import { NativeMarket } from '@capgo/native-market';
// 앱 스토어 목록 열기
const openAppStore = async () => {
await NativeMarket.openStoreListing({
appId: 'com.example.app' // 앱의 번들 ID
});
};
// 앱 리뷰 요청
const requestReview = async () => {
await NativeMarket.requestReview();
};
// 앱 스토어 검색 열기
const searchInStore = async () => {
await NativeMarket.search({
terms: 'fitness app' // 검색어
});
};

지정된 앱의 앱 스토어 목록을 엽니다.

interface OpenStoreListingOptions {
appId: string; // iOS의 번들 ID, Android의 패키지 이름
}

사용자에게 앱 내 리뷰를 요청합니다. iOS 10.3+에서는 앱을 떠나지 않고 평가 대화 상자를 표시합니다.

검색 결과와 함께 앱 스토어를 엽니다.

interface SearchOptions {
terms: string; // 사용할 검색어
}
  • iOS 10.3+에서 앱 내 리뷰에 SKStoreReviewController 사용
  • 이전 버전에서는 App Store를 여는 것으로 대체
  • Google Play Store 열기
  • 사용 가능한 경우 앱 내 리뷰 API 사용
import { NativeMarket } from '@capgo/native-market';
import { Capacitor } from '@capacitor/core';
export class AppService {
async rateApp() {
try {
// 먼저 앱 내 리뷰 시도
await NativeMarket.requestReview();
} catch (error) {
// 스토어 목록 열기로 대체
const platform = Capacitor.getPlatform();
const appId = platform === 'ios'
? 'id123456789' // iOS 앱 ID
: 'com.example.app'; // Android 패키지 이름
await NativeMarket.openStoreListing({ appId });
}
}
}