Android - How to open the Hangout app from a Hangout URL displayed in the webview?

New to Rails picture New to Rails · May 14, 2015 · Viewed 11.3k times · Source

I just made an Android app where I am displaying my website in a webview.
My webpage has many links to Google Hangouts URL (https://talkgadget.google.com/hangouts/_/g23uuqx.......) in which there are people in a call.

enter image description here

When this link is clicked on a Desktop's browser, the URL gets opened in a new tab and the user is able to join the Google Hangout call.

When this link is clicked on a Mobile's browser, the hangout app get's opened and the user is able to join the call. How can have the same effect when the link is clicked in WebView?

When I open the hangout URL in mobile app(webview), it opens the google play webpage in my app(webview) and asks me to install hangout which I already have installed.

enter image description here

Instead of going to google play store within the webview of my app,

(When Google Hangouts app is installed on the Android phone)
1) How do I open the hangout app from my app which has hangout URLs of this form(https://talkgadget.google.com/hangouts/_/g23uuqx.......) in the webview of my app?

(When Google Hangouts app is not installed on the Android phone)
2) How to open Google playstore app and inform the user to Install Google Hangout app in order to join the call?

Kindly help. Thanks.

Answer

Mikhail Naganov picture Mikhail Naganov · May 14, 2015

You can use WebViewClient.shouldOverrideUrlLoading to catch these links and then start an appropriate activity. A good example of how to launch the Google Play app this way is described here: Allow all 'market://' links from inside a webview to open Google Play store