5

Google recently implemented a feature into Google Search that allows a user to install your app on the fly if the result can be opened in your app.

Is there any way to detect if this is how your app was opened? Installed and deep linked from a Google Search?

Nachi
  • 4,218
  • 2
  • 37
  • 58
Kyle Jahnke
  • 685
  • 3
  • 15
  • There is always `getCallingActivity` http://developer.android.com/reference/android/app/Activity.html#getCallingActivity%28%29 – njzk2 Apr 28 '15 at 13:42

1 Answers1

5

You can query the Intent extra android.intent.extra.REFERRER_NAME in your Activity to check if your app was deep-linked from Google Search.

From the documentation

The value of the extra will have one of the following formats, depending on the type of referrer:

App referrer — "android-app://{package_id}/{scheme}/{host_path}"

Web referrer — "https://{host_path}"

Nachi
  • 4,218
  • 2
  • 37
  • 58
  • This is only from the Google app, not from search results in a mobile browser, eh? – Turnsole Sep 01 '15 at 22:26
  • 1
    Also from the browser if you are logged in to Google. – Nachi Oct 03 '15 at 09:33
  • That's interesting, I've not been able to observe any referrer when following a deep link from a browser's Google search results. – Turnsole Oct 05 '15 at 21:48
  • Someone at Google was the first-hand source for that information - I have however not tested it myself and it is possible that they were incorrect. – Nachi Oct 06 '15 at 09:10