Search code examples
androiddeep-linkingandroid-app-indexing

Android app indexing - deep linking for urls with GET params like www.abc.com?parameter=value


I'm creating a intent-filter in order to filter in my app urls like https://www.hotelsclick.com/?hotel_id=135738

I see in the documentation that I should create an intent filter like

 <intent-filter android:label="@string/filter_title_viewgizmos">
     <action android:name="android.intent.action.VIEW" />
     <!-- Accepts URIs that begin with "http://example.com/gizmos” -->
     <data android:scheme="http"
           android:host="example.com"
           android:pathPrefix="/gizmos" />
     <category android:name="android.intent.category.DEFAULT" />
     <category android:name="android.intent.category.BROWSABLE" />
 </intent-filter>

This intent-filter should filter URLs like "http://example.com/gizmos?1234, http://example.com/gizmos/1234, http://example.com/gizmos/toys/1234"

That's good but... my URL is different, it's like http://example.com?toys=1234 'cause it's got a named GET parameter just in the home page, which is hotel_id.

How can I filter such URLs? Is there some more parameter to put in the intent-filter definition?

Edit: I put the following intent-filter in my Manifest.xml

        <intent-filter android:label="@string/app_name">
            <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="hotelsclick.com" />
            <data android:scheme="http"
                android:host="hotelsclick.com" />
        </intent-filter>

and I CAN open the app by providing this ADB command

adb shell am start -a android.intent.action.VIEW -d "http://hotelsclick.com?hotel_id=135738" com.towers.hotelsclick

BUT it doesn't work from the page self-generated with the deep-link tool: https://developers.google.com/app-indexing/webmasters/test?hl=it

I put in the webpage the following URI in the editText: "android-app://com.towers.hotelsclick/hotelsclick.com?hotel_id=135738" and I got this page: https://applinktest.appspot.com/app-link.html?url=android-app%3A%2F%2Fcom.towers.hotelsclick%2Fhotelsclick.com%3Fhotel_id%3D135738

As you can see the link in the page is intent://#Intent;scheme=hotelsclick.com?hotel_id=135738;package=com.towers.hotelsclick;end and I expected this intent-link to be opened by the app itself when clicked on mobile on the same phone I used for the adb command before. But it doesn't work and takes me straight to the google play store, suggesting to open the app from there

enter image description here

So, since I can make the intent-filter work via ADB but not with a proper link, can I say I succeeded or not?

Thank you


Solution

  • The generated link is not valid. It should be

    intent://hotelsclick.com?hotel_id=135738#Intent;scheme=http;package=com.towers.hotelsclick;end

    instead of

    intent://#Intent;scheme=hotelsclick.com?hotel_id=135738;package=com.towers.hotelsclick;end