Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put my app in the Google Now Phone search list (Android Global Search)

Tags:

android

search

I want to make my app searchable in the Google Now quick search box. I followed some examples but it still doesn't work. The official doc isn't clear at all about how to make this case work.

Now after checking these stackoverflow issues, I start wondering if this feature is still available to the developer?

Is global search in android still available for developer?

How do I get my app to appear in Google Now's Phone Search list?

I do see a few apps still make into the "Phone search" list in the quick search box settings. If so, anyone can shed some light for me? My searchable config xml is as follows

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/app_name"
    android:hint="@string/search_hint"
    android:searchSuggestAuthority="@string/search_authority"
    android:searchSuggestIntentAction="android.intent.action.VIEW"
    android:searchSuggestIntentData="content://some_search_authority"
    android:includeInGlobalSearch="true">
</searchable>

In this AndroidManifest.xml file, I do have meta-data specified for the SearchableActivity e.g.

<activity ...>
    <intent-filter>
        <action android:name="android.intent.action.SEARCH" />
    </intent-filter>
    <meta-data
        android:name="android.app.searchable"
        android:resource="@xml/searchable" />
</activity>
like image 477
hxc Avatar asked Apr 14 '15 18:04

hxc


People also ask

What is global search in Android?

Search is presented as an overlay on the home screen. Users access it by navigating to the Home screen, then pressing the microphone button. Alternately, from the Home screen users can navigate up, focus on, and click the microphone button. The global search experience is optimized for TV.

How to make search button in Android?

Invoking the search dialog For instance, you should add a Search button in your Options Menu or UI layout that calls onSearchRequested() . For consistency with the Android system and other apps, you should label your button with the Android Search icon that's available from the Action Bar Icon Pack.


1 Answers

It's not possible (at least, yet).

Google Music has a Google Now card and to have something similar, you need to create your own.
Unfortunately, it has no public API yet: Google Now integrations

Now cards from apps are currently under development and are not available to all apps. We'll let you know when we are able to onboard more partners.

What you can do is to add your app into the list of suggestion for command "Play (Band name) (Song name)":

enter image description here

To make this happen, you have to add intent-fiters to your Activity, which should be opened to AndroidManifest:

    <activity
        android:name=".MusicActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

You can check out list of Google Now voice commands here: A list of all the Google Now voice commands

I hope, it helps

like image 117
Konstantin Loginov Avatar answered Oct 16 '22 16:10

Konstantin Loginov