Start a Project

To open a URL from anywhere on the device, in your app

Many times we have seen that there are some URL(s) in our phone like in a email or whatsapp etc. and when clicked on them they take us to a particular application in our phone rather than to browser like there is a URL of facebook in your chat then on click on it the link is opened in Facebook app ( if you have Facebook application in your device), so i can we implement it for our own application.

So here I am having an app that should be opened when a particular URL is clicked. I made a simple one which will show the URI in a textview but you can use the url as you want. You can extract the values from it and perform some action.

Firstly you have to mention Intent Action_View of Browsable catregory in the android manifest with the particular activity you want to open on particular URL hit, it can be done as

Now your activity will be launched whenever a URL with the path as mentioned in <data> tag will be clicked. But remember the android system will still ask User whether he/she wants to open the URL with your app or with Browser.

Now lets get the URI in our Activity

And thats all. Try it yourself. Happy Coding!!

Exit mobile version