Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to get webView webpage links to open up Google Play Store?
Started by fazilreyaz May 28 2018 09:34 AM

8 replies to this topic
webview play store links webpage
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

fazilreyaz

[GLOBAL: userInfoPane.html]
fazilreyaz
  • Enthusiast

  • 60 posts
  • Corona SDK

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,



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,291 posts
  • Corona SDK

Do you have the proper permissions in build.settings?

 

 
android = {
...


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


...
   },


[TOPIC: post.html]
#3

fazilreyaz

[GLOBAL: userInfoPane.html]
fazilreyaz
  • Enthusiast

  • 60 posts
  • Corona SDK

 

Do you have the proper permissions in build.settings?

 

 
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",
            },


    },

}


[TOPIC: post.html]
#4

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 1,878 posts
  • Corona SDK

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.


  • roaminggamer likes this

[TOPIC: post.html]
#5

fazilreyaz

[GLOBAL: userInfoPane.html]
fazilreyaz
  • Enthusiast

  • 60 posts
  • Corona SDK

Would you mind sharing some of your code?

[TOPIC: post.html]
#6

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 1,878 posts
  • Corona SDK

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/');
}
?>

  • roaminggamer likes this

[TOPIC: post.html]
#7

fazilreyaz

[GLOBAL: userInfoPane.html]
fazilreyaz
  • Enthusiast

  • 60 posts
  • Corona SDK

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,

[TOPIC: post.html]
#8

fazilreyaz

[GLOBAL: userInfoPane.html]
fazilreyaz
  • Enthusiast

  • 60 posts
  • Corona SDK

 

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 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.



[TOPIC: post.html]
#9

fazilreyaz

[GLOBAL: userInfoPane.html]
fazilreyaz
  • Enthusiast

  • 60 posts
  • Corona SDK

Anyone there who can help me out with this?


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: webview, play store, links, webpage