Commencer
-
Installer 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 -
Synchroniser with Natif 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
Utilisation
Section titled “Utilisation”Importer the plugin and use its methods to redirect Utilisateurs to Application 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 Référence
Section titled “API Référence”openStoreListing(Options)
Section titled “openStoreListing(Options)”Opens the Application Store listing for the specified Application.
interface OpenStoreListingOptions { appId: string; // Bundle ID on iOS, Package name on Android}requestReview()
Section titled “requestReview()”Requests an in-Application review from the Utilisateur. On iOS 10.3+, this shows the rating dialog without leaving the Application.
Recherche(Options)
Section titled “Recherche(Options)”Opens the Application Store with Recherche results.
interface SearchOptions { terms: string; // Search terms to use}Platform Notes
Section titled “Platform Notes”- Uses
SKStoreReviewControllerfor in-app reviews on iOS 10.3+ - Falls Retour to opening Application Store for older versions
Android
Section titled “Android”- Opens Google Play Store
- Uses in-Application review API when Disponible
Exemple
Section titled “Exemple”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 }); } }}