Yes you can do it. You register activity in your application as a handler for your own protocol (scheme). The application manifest will be something like:
<activity android:name=".SchemeActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myownprotocol" /> </intent-filter> </activity>
This action will not be displayed or get an icon in the application launcher, so you are likely to have βnormalβ activity in addition to this.
Now any web page can have a link, as shown below:
<a href="myownprotocol://12345">Sample link</a>
With the application installed, you can click such a link in a web browser and display SchemeActivity in my example. Inside this action, you can get the whole link (and parse the extra identifier / data or whatever you have):
String fullUrl = getIntent().getDataString();
source share