8

I am using app indexing in my app but sometimes it is not receiving correctly the intents from Chrome.

If I open the link from my production website, it is opened by chrome. So I have created a testing site which has the same code. However, in this case, my app is opening the deep link correctly.

I can't find any explanation as it is using the same code in the web (but in diferent sites) and the same Android app.

This is my intent-filter:

        <intent-filter android:autoVerify="true">
            <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="soriabus-web.appspot.com" android:pathPrefix="/" />
        </intent-filter>

This is the html code in my button:

<a href="https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados/true"
"type="button"
role="button"
class="btn btn-primary">
Abrir Soria Bus
</a>

If I open the link in this address (production), it opens Play Store (the end of the link is a redirect to Google Play):

https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados

If I open the link in this other address (test), it opens my app correclty:

https://central-splice-128620.appspot.com/parada/1/plaza-mariano-granados

I don't understand why the links are handled differenty. Thank you.

EDIT:

Is it because I am following a link inside the same site?

https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados => https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados/playstore

Javier Delgado
  • 2,343
  • 2
  • 17
  • 31

1 Answers1

2

If you tested it in Android browser(the default browser until Android 4.2), it works. So it seems it's a feature from Android chrome browser. referred from here: https://developer.chrome.com/multidevice/android/intents

And Chrome doesn’t launch an external app for a given Intent URI in the following cases.

When the Intent URI is redirected from a typed in URL.
When the Intent URI is initiated without user gesture.

In your case, it's the same as a typed url.

You should try the intent:// syntax from above page which is recommended by Google, if you want to open it from chrome.

xfdai
  • 2,735
  • 1
  • 19
  • 18
  • Isn't Chrome the Android default browser? – Javier Delgado Nov 08 '16 at 10:22
  • Or I could reask my question as "why is my case the same as type an url if my action is pressing a button?" – Javier Delgado Nov 08 '16 at 10:49
  • @JavierDelgado Sorry, it named Android browser, the default browser before Android 4.2, I edited this part in my answer. could you please try the `intent` way which I mentioned? – xfdai Nov 08 '16 at 11:25
  • I have changed my button code to the one in the example webpage: Abrir Soria Bus. It works for Chrome and Android browsers in my phone, but it doesn't work it desktop (with the fallback_url). I raise "scan GET (canceled)" – Javier Delgado Nov 08 '16 at 21:58
  • And I still don't understand why does it work with chrome for a different webpage. – Javier Delgado Nov 08 '16 at 21:58
  • @JavierDelgado As I know for deeplink, you should automatically return different link from server side depend on the client type, since PC, Android, and iOS use different links. – xfdai Nov 09 '16 at 01:16
  • But S.browser_fallback_url should work in Chrome in desktop, right? – Javier Delgado Nov 09 '16 at 11:42
  • @JavierDelgado fallback url is for the case your app is not installed on the device, and the document is for Android chrome, not the PC chrome, it's totally different. – xfdai Nov 09 '16 at 12:58