Search code examples
androidandroid-intentfirebaseintentfilterfirebase-dynamic-links

deep link starts app but says uri is null


I have implemented deep linking in my app. Sure enough, when I click on a link from a browser, it opens the app. But when I do

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

both action and data are null. What would cause such a thing? I imagine the fact that it opens my app means it has a uri.

Here is my intent filter

<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:host="www.mywebsite.com"
                android:scheme="http"/>
            <data
                android:host="www.mywebsite.com"
                android:scheme="https"/>
            <data
                android:host="mywebsite.com"
                android:scheme="http"/>
            <data
                android:host="mywebsite.com"
                android:scheme="https"/>
            <data
                android:host="/*"
                android:scheme="mywebsite"/>
        </intent-filter>

Solution

  • Make sure you're checking the Intent from the right Activity.

    e.g. that your intent-filter is set on the launch Activity while you're checking for the Intent on the following Activity