0

How would the deep link in the manifest be to open an activity with this link

https://myapp.domain.com/#/view/abc

where only abc is the argument that changes and is the one that I need the app to take as a parameter .

I have tried this but it did not work

            <data
                android:host="myapp.domain.com"
                android:pathPrefix="/#/view"
                android:scheme="https" />
            <data
                android:host="myapp.domain.com"
                android:pathPrefix="/#/view"
                android:scheme="http" />
            <data
                android:host="myapp.domain.com"
                android:pathPrefix="/#/view"
                android:scheme="app" />
Luis Quijada
  • 3
  • 1
  • 5

2 Answers2

0

Try this inside Activity Tag in Manifest file

<intent-filter android:label="Example">
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
            
      <data android:scheme="https"
            android:host="myapp.domain.com"
            android:pathPrefix="/#" />
            <!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>

Inside Activity.java

 Uri uri = getIntent().getData();
 
 if(uri != null){
      List<String> segments = uri.getPathSegments();
      Log.e(TAG, "onCreate: "+segments );
      Log.e(TAG, "onCreate: "+segments.get((segments.size()-1)) );
 }
Rohaitas Tanoli
  • 624
  • 4
  • 16
0

After hard work I used this:

<data android:scheme="https"
        android:host="myapp.domain.com"
        android:pathPrefix="/" />

And in my Activity:

 String id = data.toString().replaceAll(".*/", "");

NOTE: I couldn't use uri.getPathSegments(); because it returns me empty list.

Luis Quijada
  • 3
  • 1
  • 5