在Phonegap应用程序中打开Google Play / Rate App

Open Google Play / Rate App in Phonegap App

本文关键字:Play Rate App Google Phonegap 应用程序      更新时间:2023-09-26

我想打开一个确认窗口,该窗口在应用程序启动时弹出。如果您单击确定,您应该被重定向到谷歌Play商店以对应用程序进行评级。InAppView是一个非常糟糕的解决方案,可以对它真正应该在本机应用商店应用程序中打开的应用程序进行评级。

我试过这个,但它不起作用:

window.open("market://details?id=com.publishername.myapp");

还有这个:

window.open("https://play.google.com/store/apps/details?id=com.YourApp", "_system");

我已经阅读了其他一些线程,但"解决方案"不起作用。

有没有办法将用户重定向到 Play 商店以对应用进行评分?

感谢您的帮助!

基本上评级代码应该从安卓端处理。下面是代码:

public static void showRateDialog(final Context mContext) {
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setMessage(
            "If you enjoy using "
                    + APP_TITLE
                    + ", please take a moment to rate it. Thanks for your support!")
            .setTitle("Rate " + APP_TITLE)
            .setCancelable(false)
            .setIcon(R.drawable.ic_launcher)
            .setPositiveButton("Rate TempleRun2",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            mContext.startActivity(new Intent(
                                    Intent.ACTION_VIEW,
                                    Uri.parse("https://play.google.com/store/apps/details?id=com.imangi.templerun2")));

                            dialog.dismiss();
                        }
                    })
            .setNegativeButton("Remind me later",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.cancel();
                        }
                    })
            .setNeutralButton("No'nThanks",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.dismiss();
                        }
                    });
    AlertDialog alert = builder.create();
    alert.show();
}

希望这有帮助。