指南
Native Market教程
使用@capgo/native-market
Capacitor Native Market插件,用于打开应用商店列表和页面。
安装
bun add @capgo/native-market
bunx cap sync
此插件暴露的内容
openStoreListing- 在Play Store (Android)或App Store (iOS)中打开应用列表页面。openDevPage- 直接深链到Play Store中的开发者页面。仅限Android。openCollection- 将用户链接到Play Store的收藏或热门榜单。仅限Android。openEditorChoicePage- 在 Play Store 中为用户推荐编辑的选择页面。仅限 Android。
示例用法
openStoreListing
在 Play Store 中打开应用清单页面(仅限 Android)或 App Store 中打开应用清单页面(仅限 iOS)。
import { NativeMarket } from '@capgo/native-market';
// Open app in store
await NativeMarket.openStoreListing({
appId: 'com.example.app'
});
// Open app in specific country store (iOS only)
await NativeMarket.openStoreListing({
appId: 'com.example.app',
country: 'IT'
});
openDevPage
直接在 Play Store 中深度链接到开发者的页面。仅限 Android。
import { NativeMarket } from '@capgo/native-market';
await NativeMarket.openDevPage({
devId: 'Google+LLC'
});
openCollection
在 Play Store 中为用户推荐收藏或热门榜单。仅限 Android。
import { NativeMarket } from '@capgo/native-market';
await NativeMarket.openCollection({
name: 'featured'
});
openEditorChoicePage
在 Play Store 中为用户推荐编辑的选择页面。仅限 Android。
import { NativeMarket } from '@capgo/native-market';
await NativeMarket.openEditorChoicePage({
editorChoice: 'editorial_fitness_apps_us'
});
全局参考
- GitHub: https://github.com/Cap-go/capacitor-native-market/
- 文档:/docs/plugins/native-market/