1

I am doing a little research on the on-device Search mechanism for the Android system. I have noticed that some content, like the music I have on my device, is displayed below search results, when searching with the Google Now search mechanism. A tap on such record will open an app (in case of music it will be Google Music) with the selected content.

The question is - how is this implemented? I know about the global search mechanism (discontinued from Android 4.4) and the App Indexing API (which requires a link between my app content and website content). However, the example above is clearly local, so I do not believe it is App Indexing. And if not that, then what?

I have found this form from Google, which seems to correspond to my problem, but maybe there is another approach I know not of?

Kelevandos
  • 7,024
  • 2
  • 29
  • 46

2 Answers2

1

You can use App Indexing API without linking to web content. Just pass Uri.parse("") aka an empty Uri as web url.

Florian Barth
  • 1,392
  • 12
  • 25
  • What do you mean "use"? I want my app content to be reachable in the Search mechanism, will your solution enable that? If so, where do I pass the object you mentioned? – Kelevandos Oct 15 '15 at 09:38
  • 1
    Follow the instructions at the link I supplied to implement App Indexing API, leave out the web related stuff and pass "empty url" when calling `Action.newAction(Action.TYPE_VIEW, title, WEB_URL, APP_URI)`. – Florian Barth Oct 15 '15 at 09:49
  • And yes, it will then be reachable for the Search mechanism (though I'm not sure, if this applies to dev builds or only for prod builds) – Florian Barth Oct 15 '15 at 09:49
  • Oh, you are referring to the Client object, ok, now I get it. But I still do not understand how it would possibly be able to reference anything from my app's content without me supplying some data set reference. Could you elaborate on that? – Kelevandos Oct 15 '15 at 09:56
  • In the APP_URI you supply the apps schema url, e.g. `my-great-app://products/id_for_a_great_product` and here you go. – Florian Barth Dec 01 '15 at 18:01
0

What you are describing with Google Music could possibly be explained by you being logged in, in both of those apps. So through your Google account, the Google Now feature allowed that to happen. It is similar to when you have a flight ticket in your gmail, and when the time is approaching, Google Now presents you with that information.

If however, your app is to be used as a local media player, then you probably need to wait for Google to release the app-only app indexing. Currently is in development, despite you can manifest your interest in participating by filling up this form - https://developers.google.com/app-indexing/app-only

The App Indexing API is now core part of App Indexing, and currently it will only work if you have a website associated to your app. More information here - https://developers.google.com/app-indexing/android/publish

Stan Ct
  • 366
  • 1
  • 6