从主页按钮启动我的应用程序

时间:2018-05-28 13:59:27

标签: android

当我通过长按操作按下主页按钮时,有没有办法启动我的Android应用程序

我尝试像这样配置我的主要活动

<activity android:name="AwesomeActivity">
<intent-filter>
    <action.  android:name="android.intent.action.ASSIST"/>
    <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data
    android:name="com.android.systemui.action_assist_icon"
    android:resource="@drawable/app_icon"/>
</activity>  but doesn't work for me 

1 个答案:

答案 0 :(得分:1)

没有办法。您无法在无根设备中覆盖HOME按钮。 https://developer.android.com/reference/android/view/KeyEvent#keycode_home

  

KEYCODE_HOME   在API级别1中添加   int KEYCODE_HOME   密钥代码常量:Home键。此密钥由框架处理,永远不会传递给应用程序。

相关问题