Getting Started
Dieser Inhalt ist in Ihrer Sprache noch nicht verfügbar.
-
Install the package
Terminal-Fenster npm i @capgo/native-marketTerminal-Fenster pnpm add @capgo/native-marketTerminal-Fenster yarn add @capgo/native-marketTerminal-Fenster bun add @capgo/native-market -
Sync with native projects
Terminal-Fenster npx cap syncTerminal-Fenster pnpm cap syncTerminal-Fenster yarn cap syncTerminal-Fenster 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 }); } }}