How to get webView webpage links to open up Google Play Store?

Hello everyone,

I have a web page which is being called through webView. On that web page I have shown all my apps. On the basis of platform (iOS and Android) urls get changed. Everything is working fine but when I try to click on any of the link of web page via android device it doesn’t open up google play store but keeps the link inside of the webView. 

On iOS device, app store directly opens up if any link is clicked.

So, I want to know is there any way to open up Google Play Store on android device?

I tried multiple type of links like:

1. https://play.google.com/store/apps/details?id=com.games3ctechies.thelie1

2. http://market.android.com/details?id=com.games3ctechies.thelie1

3. market://details?id=com.games3ctechies.thelie1

If we try to access second link through android browser, it directly opens up google play store. So, if a browser can perform this task then why not webView?

Any help would be highly appreciated.

Thanks,

Do you have the proper permissions in build.settings?

https://docs.coronalabs.com/guide/distribution/buildSettings/index.html 

android = { ...       usesPermissions = {          "android.permission.INTERNET", ...       }, ...    },

Build setting file:

settings = { android =     {         usesPermissions =         {             "android.permission.VIBRATE",             "android.permission.INTERNET",           "android.permission.ACCESS\_WIFI\_STATE",     "android.permission.READ\_PHONE\_STATE",     "android.permission.ACCESS\_NETWORK\_STATE",         },     }, orientation = { default = "landscapeRight", supported = { "landscapeRight", "landscapeLeft" } }, iphone = { xcassets = "Assets.xcassets", plist = { NSAppTransportSecurity = {     NSAllowsArbitraryLoads = true,     NSExceptionDomains =     {         ["mywebsite.com"] =         {             NSIncludesSubdomains = true,             NSExceptionAllowsInsecureHTTPLoads = true,              },     }, }, UIAppFonts =             {                 "BIMINR.TTF", "AriaScriptSSK.ttf"             }, UIStatusBarHidden = false, UIPrerenderedIcon = false,  UIApplicationExitsOnSuspend = false,  UILaunchStoryboardName = "LaunchScreen", }, }, }

What I do is send all (install) clicks to a php page.  In that php page I sniff the device and send to the appropriate app store.

Consider this a web issue not a Corona issue and adapt accordingly.

Would you mind sharing some of your code?

Try this

\<?php $user\_agent = $\_SERVER['HTTP\_USER\_AGENT']; $iPod = stripos($user\_agent,"iPod"); $iPhone = stripos($user\_agent,"iPhone"); $iPad = stripos($user\_agent,"iPad"); if ($ipod || $iPhone || $iPad) { header('Location:https://itunes.apple.com/'); } else{ header('Location:https://play.google.com/'); } ?\>

I have done the same but in asp.net.

http://www.3ctechies.com/mobileapps.aspx?platform=Android
http://www.3ctechies.com/mobileapps.aspx?platform=iOS

But got no luck with this.

Now I am creating a php file and will check the same.

Hope it works.

Thanks,

I tried with PHP also but got the same results.

Not opening up play store app.

I believe it’s a problem with webView because when I check the same url through android browser like chrome or some other and click on any app it directly opens up play store.

So it means something is wrong with webView.

Please any help would be highly appreciated.

Anyone there who can help me out with this?

Do you have the proper permissions in build.settings?

https://docs.coronalabs.com/guide/distribution/buildSettings/index.html 

android = { ... &nbsp; &nbsp; &nbsp; usesPermissions = { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"android.permission.INTERNET", ... &nbsp; &nbsp; &nbsp; }, ... &nbsp; &nbsp;},

Build setting file:

settings = { android = &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; usesPermissions = &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "android.permission.VIBRATE", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "android.permission.INTERNET", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "android.permission.ACCESS\_WIFI\_STATE", &nbsp; &nbsp; "android.permission.READ\_PHONE\_STATE", &nbsp; &nbsp; "android.permission.ACCESS\_NETWORK\_STATE", &nbsp; &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; }, orientation = { default = "landscapeRight", supported = { "landscapeRight", "landscapeLeft" } }, iphone = { xcassets = "Assets.xcassets", plist = { NSAppTransportSecurity = { &nbsp; &nbsp; NSAllowsArbitraryLoads = true, &nbsp; &nbsp; NSExceptionDomains = &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; ["mywebsite.com"] = &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSIncludesSubdomains = true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSExceptionAllowsInsecureHTTPLoads = true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; }, &nbsp; &nbsp; }, }, UIAppFonts = &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "BIMINR.TTF", "AriaScriptSSK.ttf" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }, UIStatusBarHidden = false, UIPrerenderedIcon = false,&nbsp; UIApplicationExitsOnSuspend = false,&nbsp; UILaunchStoryboardName = "LaunchScreen", }, }, }

What I do is send all (install) clicks to a php page.  In that php page I sniff the device and send to the appropriate app store.

Consider this a web issue not a Corona issue and adapt accordingly.

Would you mind sharing some of your code?

Try this

\<?php $user\_agent = $\_SERVER['HTTP\_USER\_AGENT']; $iPod = stripos($user\_agent,"iPod"); $iPhone = stripos($user\_agent,"iPhone"); $iPad = stripos($user\_agent,"iPad"); if ($ipod || $iPhone || $iPad) { header('Location:https://itunes.apple.com/'); } else{ header('Location:https://play.google.com/'); } ?\>

I have done the same but in asp.net.

http://www.3ctechies.com/mobileapps.aspx?platform=Android
http://www.3ctechies.com/mobileapps.aspx?platform=iOS

But got no luck with this.

Now I am creating a php file and will check the same.

Hope it works.

Thanks,

I tried with PHP also but got the same results.

Not opening up play store app.

I believe it’s a problem with webView because when I check the same url through android browser like chrome or some other and click on any app it directly opens up play store.

So it means something is wrong with webView.

Please any help would be highly appreciated.

Anyone there who can help me out with this?