替换Google即时手势

Ste*_*fMa 25 android google-now

如果您想在Nexus设备上启动Google即时,可以使用导航栏中的简单手势向上滑动.我想用我自己的应用程序替换此功能.如果您滑动,应用程序选择器会询问您要启动哪个应用程序:我的应用程序或Google即时.我该如何实现呢?

我找到了一个没有root运行的例子.

Rag*_*ood 42

将以下内容添加<intent-filter>到要从手势启动的活动中:

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

    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)

现在,当您进行滑动时,您将看到应用程序的选项,并且必须通过选择"始终"将其选择为默认处理程序,如下所示.

在此输入图像描述

  • &lt;meta-data android:name="com.android.systemui.action_assist_icon" android:resource="@android:drawable/sym_def_app_icon" /&gt; (5认同)

Bud*_*ius 8

这只是设置正确的intent过滤器的问题:

<intent-filter>
    <action android:name="android.intent.action.ASSIST"/>
    <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
Run Code Online (Sandbox Code Playgroud)