Simple deeplinking

These are instructions to support and test simple deeplinking, without Firebase or the Navigation Components.


Add an Intent filter to your manifest and specify which URLs should open your Activity:

<intent-filter android:label="@string/filter_title_viewgizmos">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with "ā€ -->
    <data android:scheme="http"
          android:pathPrefix="/stuff" />
    <!-- note that the leading "/" is required for pathPrefix-->
    <!-- note that only one <data> per intent-filter is allowed -->

Handle the URL inside your Activity:

Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
String relevantPart = data.getLastPathSegment();


Test it through the command line:

adb shell am start -W -a android.intent.action.VIEW -d

Or, when using the script, like so:

./ open