open link of google play store in mobile version android
You'll want to use the specified market
protocol:
final String appPackageName = "com.example"; // Can also use getPackageName(), as below
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
Keep in mind, this will crash on any device that does not have the Market installed (the emulator, for example). Hence, I would suggest something like:
final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
}
While using getPackageName()
from Context
or subclass thereof for consistency (thanks @cprcrack!). You can find more on Market Intents here: link.
Open play store app from browser link
I got it working by using the below url on redirect
window.location.href = "https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=com.myapp";
When I visit this url from the browser of my mobile, it does not open the play store within browser but opens the play store app instead. This serves my purpose.
How to open the Google Play Store directly from my Android application?
You can do this using the market://
prefix.
Java
final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
Kotlin
try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName")))
} catch (e: ActivityNotFoundException) {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=$packageName")))
}
We use a try/catch
block here because an Exception
will be thrown if the Play Store is not installed on the target device.
NOTE: any app can register as capable of handling the market://details?id=<appId>
Uri, if you want to specifically target Google Play check the Berťák answer
Play Store app details link not working on phone
This was caused by a bug in the Play Store, and is in the process of being fixed. You should see the fix soon.
How to make a web link open directly on Google Play Store
As explained here, Google Play provides url protocol
market://details?id=<package_name>
Applying on Blogger :
Place the following javascript code at the bottom and before </body>
. This will change Google Play links only on Android.
<script>
if (/(android)/i.test(navigator.userAgent)) {
document.querySelectorAll('a[href]').forEach(function (link) {
link.href = link.href.replace('https://play.google.com/store/apps/','market://');
});
}
</script>
App in Open Testing phase on Play Store can't be accessed
If you see there it says "In review", you should expect them to review and approve it since there are many cases of misuse of apps in the Play Store.
Related Topics
Locationclient Getlastlocation() Return Null
Alarmmanager Fires Alarms at Wrong Time
Android - Java.Lang.Securityexception: Permission Denial: Starting Intent
Connecting to MySQL from Android with Jdbc
Remove Data from Notification Intent
Updating Paging 3 Alpha to Stable Cause Indexing Issue Android
Spinner: Get State or Get Notified When Opens
Actionbar Notification Count Icon (Badge) Like Google Has
Should We Use Recyclerview to Replace Listview
How Did Google Manage to Do This? Slide Actionbar in Android Application
How to Get the Dialer to Open with Phone Number Displayed
Android. Is Workmanager Running When App Is Closed
Android Arraylist of Custom Objects - Save to Sharedpreferences - Serializable
Execute Asynctask Several Times