How to search in my app through Google Now / Google App

时间:2016-08-31 12:11:21

标签: java android android-studio google-now

Does anybody know how to search in my app using Google Now? I tried looking for sources but there's a few of them .. Please help



Example search on Youtube app:

enter image description here




What i tried:

AndroidManifest.xml

<activity android:name="***.*****.*********.ui.activity.HomeActivity">
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.VOICE"/>
        </intent-filter>

        <meta-data
            android:name="android.app.default_searchable"
            android:value=".HomeActivity" />
        <meta-data
            android:name="android.app.searchable"
            android:resource="@xml/searchable" />
</activity>



searchable.xml

<searchable
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/app_name"
    android:includeInGlobalSearch="true"
    android:searchSuggestAuthority="@string/app_name"
    android:hint="@string/searchable">
</searchable>

0 个答案:

没有答案