Getting Started
Ce contenu n'est pas encore disponible dans votre langue.
-
Install the package
Fenêtre de terminal npm i @capgo/native-marketFenêtre de terminal pnpm add @capgo/native-marketFenêtre de terminal yarn add @capgo/native-marketFenêtre de terminal bun add @capgo/native-market -
Sync with native projects
Fenêtre de terminal npx cap syncFenêtre de terminal pnpm cap syncFenêtre de terminal yarn cap syncFenêtre de terminal bunx cap sync
Usage
Import the plugin and use its methods to redirect users to app stores:
import { NativeMarket } from '@capgo/native-market';
// Open app store listingconst openAppStore = async () => { await NativeMarket.openStoreListing({ appId: 'com.example.app' // Your app's bundle ID });};
// Request app reviewconst requestReview = async () => { await NativeMarket.requestReview();};
// Open app store searchconst searchInStore = async () => { await NativeMarket.search({ terms: 'fitness app' // Search terms });};
API Reference
openStoreListing(options)
Opens the app store listing for the specified app.
interface OpenStoreListingOptions { appId: string; // Bundle ID on iOS, Package name on Android}
requestReview()
Requests an in-app review from the user. On iOS 10.3+, this shows the rating dialog without leaving the app.
search(options)
Opens the app store with search results.
interface SearchOptions { terms: string; // Search terms to use}
Platform Notes
iOS
- Uses
SKStoreReviewController
for in-app reviews on iOS 10.3+ - Falls back to opening App Store for older versions
Android
- Opens Google Play Store
- Uses in-app review API when available
Example
import { NativeMarket } from '@capgo/native-market';import { Capacitor } from '@capacitor/core';
export class AppService { async rateApp() { try { // Try in-app review first await NativeMarket.requestReview(); } catch (error) { // Fallback to opening store listing const platform = Capacitor.getPlatform(); const appId = platform === 'ios' ? 'id123456789' // Your iOS app ID : 'com.example.app'; // Your Android package name
await NativeMarket.openStoreListing({ appId }); } }}