引導用戶評分是提升應用商店評分、增加曝光的關鍵運營手段。Android 通過 market:// Scheme 唤起應用市場,但不同廠商市場、海外 Google Play、國內各大應用商店對 Scheme 支持度不同。本文提供標準實現、多市場兼容策略、降級方案及埋點統計。
public void openAppRatingPage(Context context) {
String packageName = context.getPackageName();
String marketUri = "market://details?id=" + packageName;
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(marketUri));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 非 Activity 上下文需添加
try {
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
// 降級:打開 Google Play 網頁版
openWebFallback(context, packageName);
}
}
private void openWebFallback(Context context, String packageName) {
String webUrl = "https://play.google.com/store/apps/details?id=" + packageName;
Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webUrl));
webIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(webIntent);
}
| 應用商店 | Scheme 格式 | 備註 |
|---|---|---|
| Google Play | market://details?id=pkg | 標準,海外設備預裝 |
| 小米應用商店 | miui://details?id=pkg | MIUI 系統優先響應 |
| 華為應用市場 | appmarket://details?id=pkg | HMS 設備優先響應 |
| OPPO 軟件商店 | oppomarket://details?id=pkg | ColorOS 系統優先響應 |
| vivo 應用商店 | vivomarket://details?id=pkg | FuntouchOS 系統優先響應 |
| 騰訊應用寶 | androidapp://com.tencent.android.qqdownloader/detail?pkg=pkg | 需安裝應用寶 |
| 360 手機助手 | qihoo360://app/detail?pkg=pkg | 需安裝 360 |
| 百度手機助手 | baiduapp://app/detail?pkg=pkg | 需安裝百度助手 |
public void openBestRatingPage(Context context) {
String packageName = context.getPackageName();
// 1. 檢測設備廠商,優先嘗試對應市場
String manufacturer = Build.MANUFACTURER.toLowerCase(Locale.ROOT);
String preferredMarketUri = null;
if (manufacturer.contains("xiaomi") || manufacturer.contains("redmi") || manufacturer.contains("poco")) {
preferredMarketUri = "miui://details?id=" + packageName;
} else if (manufacturer.contains("huawei") || manufacturer.contains("honor")) {
preferredMarketUri = "appmarket://details?id=" + packageName;
} else if (manufacturer.contains("oppo") || manufacturer.contains("realme") || manufacturer.contains("oneplus")) {
preferredMarketUri = "oppomarket://details?id=" + packageName;
} else if (manufacturer.contains("vivo") || manufacturer.contains("iqoo")) {
preferredMarketUri = "vivomarket://details?id=" + packageName;
} else {
preferredMarketUri = "market://details?id=" + packageName; // Google Play / 通用
}
// 2. 嘗試優先市場
if (tryStartMarket(context, preferredMarketUri)) {
trackEvent("rating_open", "preferred_market");
return;
}
// 3. 降級:Google Play 標準 Scheme
if (tryStartMarket(context, "market://details?id=" + packageName)) {
trackEvent("rating_open", "google_play");
return;
}
// 4. 降級:應用寶 (國內覆蓋率高)
if (tryStartMarket(context, "androidapp://com.tencent.android.qqdownloader/detail?pkg=" + packageName)) {
trackEvent("rating_open", "yingyongbao");
return;
}
// 5. 最終降級:網頁版 Google Play
openWebFallback(context, packageName);
trackEvent("rating_open", "web_fallback");
}
private boolean tryStartMarket(Context context, String uriString) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uriString));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 關鍵:packageManager.resolveActivity 先檢查是否有處理器
if (intent.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(intent);
return true;
}
} catch (Exception ignored) {}
return false;
}
優勢:不離開 App、無需跳轉、Google Play 強制限制頻率、支持 API 21+ (覆蓋 99%+ 設備)
// build.gradle.kts
implementation("com.google.android.play:core:1.10.3")
implementation("com.google.android.play:core-ktx:1.8.1") // Kotlin 擴展
// 使用 (Kotlin 協程)
val reviewManager = ReviewManagerFactory.create(context)
val request = reviewManager.requestReviewFlow()
request.addOnCompleteListener(task -> {
if (task.isSuccessful) {
ReviewInfo reviewInfo = task.getResult();
reviewManager.launchReviewFlow(activity, reviewInfo)
.addOnCompleteListener(task2 -> {
// 用戶完成評分流程 (不一定評了分,但看過彈窗)
trackEvent("in_app_review_completed");
});
} else {
// 降級到 market:// 方案
openBestRatingPage(context);
}
});
// 邏輯:滿足條件 → 彈自定義對話框「您喜歡我們的應用嗎?」→ [喜歡] 觸發 In-App Review → [不喜歡] 跳轉反饋頁面/客服
// 這樣可過濾負面評價進入商店,提升整體評分
// 關鍵指標
trackEvent("rating_trigger", Map.of("trigger", "order_complete"));
trackEvent("rating_dialog_show", Map.of("type", "custom"));
trackEvent("rating_action", Map.of("action", "like|dislike|dismiss"));
trackEvent("in_app_review_launched");
trackEvent("in_app_review_completed");
trackEvent("market_page_opened", Map.of("market", "google_play|miui|web"));
// 計算轉化漏斗:觸發 → 彈窗展示 → 點擊喜歡 → 系統彈窗展示 → 提交評分
context.packageName評分引導是「技術實現簡單、運營策略深奧」的典型功能。建議接入 Firebase Remote Config 動態配置觸發條件、文案、頻控,實現無需發版的運營迭代。