1

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

Marco Zanetti
  • 4,051
  • 6
  • 32
  • 48
  • 1
    You can actually check this yourself and confirm. First, export the app to an apk. Go to Search Console of the app (Webmaster Tools) > Fetch as Google. Enter the appropriate url there. And instead of selecting the default Google Play APK in the next dropdown, Choose Upload APK and upload your apk. If the Google Bot is seeing the exact page you expect, then all is well. – Sasank Mukkamala Jan 24 '16 at 21:31

1 Answers1

0

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

Simon Marquis
  • 7,248
  • 1
  • 28
  • 43
  • Thank you, I tweaked a little and I managed to make the website-approach work as well. What I don't know now is this: is it good practice to put the "link rel" tag on the website while I'm still testing the app or should I just test the app with homemade links and adb commands and put the links in websire pages just after the app is published and ready to interpret such URIs? – Marco Zanetti Feb 08 '16 at 16:12