Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle deeplinking with custom scheme (Android)

I want to be able to handle deep links like this :

appnm://typeA/12
appnm://typeA/42
appnm://typeA/99
....

appnm://typeB/43
appnm://typeB/092
appnm://typeB/....
  1. Do I have to make two activities - for type A and for type B. Or can I handle both in one activity ? For example, would that work :

    data android:scheme="appnm" android:host="" android:pathPrefix="/" />

  2. when I type in some note on the phone "http:// ..." it automatically gives me the option to enter it like a link. However in my case "appnm://..." it doesn't. So how can I test the deeplink with a custom scheme ?

like image 440
BVtp Avatar asked Sep 05 '25 03:09

BVtp


1 Answers

You can add mime types which will specify what kind of data is being deeplinked. If you want all deeplinks to go to the same activity, you just declare the intent filter within that activity with only the uri scheme. However, declaring a mime type can be used to direct different kind of data to different activities.

Does this clarify your doubt?

like image 95
Shubhankar S Avatar answered Sep 07 '25 21:09

Shubhankar S