Android的 - 是否有可能禁用的主页按钮的点击 [英] Android - Is It possible to disable the click of home button

查看:129
本文介绍了Android的 - 是否有可能禁用的主页按钮的点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,当它推出我必须禁用的Andr​​oid设备上所有的按钮,我成功地禁用结束通话​​等。我需要禁用主页按钮点击。它不应该产生的点击任何行动。

I have an application, when it launches I have to disable all the buttons on Android device, I succeeded in disabling end call and others. I need to disable home button click. It should not produce any action on click.

pciated任何建议高度AP $ P $

Any suggestions highly appreciated

推荐答案

我是pretty的肯定幼儿锁只使用一个BroadcastReciever并侦听 Intent.ACTION_MAIN 而类别 Intent.CATEGORY_HOME - 这就是为什么当你第一次启动它,它会告诉你,检查使用默认应用程序对话框,让你选择蹒跚学步的锁。

I'm pretty sure Toddler Lock just uses a BroadcastReciever and listens for Intent.ACTION_MAIN and the category Intent.CATEGORY_HOME - that's why when you first launch it, it tells you to check the "use this application as default" box, and makes you select toddler lock.

因此​​,它不是真正阻止Home键的话,那只是自己设定为默认的广播接收器:

So, it's not really blocking the Home button at all, it's just setting itself up as the default broadcast receiver for:

Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);

当您启动幼儿锁,它可能设置一个内部标志,如果你preSS home键,它只是将窗口的前面。如果标志没有设置,它可能明确地启动启动。

When you launch Toddler Lock, it probably sets an internal flag, and if you press the home button, it just brings the window to the front. If the flag is not set, it probably launches Launcher explicitly.

我希望这是有道理的。这只是一个理论,但我几乎可以100%肯定这是它是如何做的。

I hope that makes sense. It's just a theory, but I'm almost 100% sure that's how it's done.

这篇关于Android的 - 是否有可能禁用的主页按钮的点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆