【问题标题】:How to send a user to Google play to rate the app?如何将用户发送到 Google Play 对应用进行评分?
【发布时间】:2020-09-03 21:29:47
【问题描述】:

我在单击按钮时调用此函数,以发送用户在 Google Play 上对应用进行评分。但它给了我错误“要查看此内容,请安装并设置网络浏览应用程序。”

private void rateMe() {
        try {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName")));
        } catch (ActivityNotFoundException e) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=$packageName")));
        }
    }

【问题讨论】:

  • Google 拦截到 Google Play 的 Android Intent,详情请参阅this post

标签: android rate


【解决方案1】:

我不知道你是用 Java 还是 Kotlin。

如果是 Java:

 private void rateMe() {
    try {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())));
    } catch (ActivityNotFoundException e) {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + getPackageName())));
    }
}

如果是 Kotlin:

private fun rateMe() {
    try {
        startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName")))
    } catch (e: ActivityNotFoundException) {
        startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=$packageName")))
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-02
    • 1970-01-01
    • 1970-01-01
    • 2018-12-14
    • 2014-12-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多