Fivos
Fivos

Reputation: 568

Can't get Uri Data from Deep Link

I want to be redirected from the browser to my App, so I use the following code for my Activity in the Manifest:

<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="fivos"
                android:host="book"
                />
        </intent-filter>

// Accepts URIs that begin with "fivos://book"

There are also some parameters in the Uri that the browser sends (For example fivos://book?username=george). In the Activity to which I am redirected, I use the following code to get the Uri but the parameters don't seem to exist in the Uridata object, except the scheme and the host

Uri URIdata = getIntent().getData();        
if(URIdata != null){
        String scheme = URIdata.getScheme();
        String host = URIdata.getHost();
        List params = URIdata.getPathSegments();
        String username = params.get(0).toString();
    }

Am I missing something in my manifest?

Upvotes: 3

Views: 5008

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006869

I use the following code to get the Uri but the parameters don't seem to exist in the Uridata object, except the sheme and the host

The stuff after the ? in a URL or Uri are the query parameters, which you can retrieve from the Uri via methods like getQuery().

Upvotes: 4

Related Questions