Replace Google Now gesture
Asked Answered
G

2

25

If you want to start Google Now on Nexus devices, you swipe-up with a simple gesture from the navbar. I want go replace this feature with my own app. if you swipe the, app-picker comes and asks you which app do you want to start: my app or Google Now. How can I implement this?

I have found an example which runs without root.

Ghislainegholston answered 9/1, 2013 at 10:36 Comment(1)
Can you check if my changes matched what you meant?Mobocracy
R
42

Add the following <intent-filter> to the Activity you want launched from the gesture:

<intent-filter>
    <action android:name="android.intent.action.ASSIST" />

    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

You will now see an option for your app when you make the swipe now, and will have to select it as the default handler by selecting Always, as shown below.

enter image description here

Ranie answered 9/1, 2013 at 12:19 Comment(3)
Is it possible to get your own icon inside the circle?Openwork
<meta-data android:name="com.android.systemui.action_assist_icon" android:resource="@android:drawable/sym_def_app_icon" />Kujawa
does not work for me, it starts google assistant on my phone and did not ask to choose from.Thierry
H
8

It's just a matter of setting the correct intent filter:

<intent-filter>
    <action android:name="android.intent.action.ASSIST"/>
    <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
Heins answered 9/1, 2013 at 11:7 Comment(3)
I know some intents don't fire unless you have both ACTION and CATEGORY. Maybe a category default for it?Heins
that dont help me. Set this on AndroidManifest or where?Ghislainegholston
hi, I edited to add an example. Please remember that it's purely guess-work of mine considering my experience. But it might be completely wrong.Heins

© 2022 - 2024 — McMap. All rights reserved.