When I tried to open play store listing of my app via intent, it is opening playstore app and shows this message, "to view this content, install and setup a web browsing app". Please see the screenshot.
I have set chrome as default browsing app. this is the code
private void launchRateUS() {
try {
Intent rateIntent = rate("market://details?id=" + getPackageName());
startActivity(rateIntent);
} catch (ActivityNotFoundException e) {
Intent rateIntent = rate("https://play.google.com/store/apps/details?id=" + getPackageName());
startActivity(rateIntent);
}
}
private Intent rate(String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("%s?id=%s", url, getPackageName())));
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
if (Build.VERSION.SDK_INT >= 21) {
flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
} else {
flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
}
intent.addFlags(flags);
return intent;
}
What is wrong with the code? How to show playstore listing instead of this message?