禁用电源按钮......或者......恢复全屏幕的Andr​​oid应用程序,蹒跚学步 [英] Disable power button... or... Resume full screen in Android toddler app

查看:150
本文介绍了禁用电源按钮......或者......恢复全屏幕的Andr​​oid应用程序,蹒跚学步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建为幼儿Android应用程序。所以,我需要访问Android设备的其他功能锁定尽可能多的按键尽可能prevent蹒跚学步。基本上,我期待重现锁定机制,如幼儿锁流行蹒跚学步的应用程序。我有逻辑,要求用户敲击屏幕四角的在顺时针运动,退出该应用

I'm creating an Android app for toddlers. So, I need to lock as many buttons as possible to prevent the toddler from accessing other features of the Android device. Basically, I'm looking to reproduce the locking mechanism in popular toddler apps like "Toddler Lock". I have logic that requires the user to tap the four corners of the screen in a clockwise motion to exit the app.

要显示全屏的应用程序,我在我的清单如下

To show the app in full-screen I have the following in my manifest

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

要显示在横向模式下的应用程序而已,我有我的活动的onCreate事件以下

To show the app in landscape mode only, I have the following in my activity's onCreate event

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

要prevent任何被使用的按钮,我重写onKeyDown事件具有以下code

To prevent any of the buttons from being used, I override the onKeyDown event with the following code

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    return true;
}

这一切的伟大工程。到目前为止,一切都很好。世界上只有一个按钮,我似乎无法禁用...电源按钮。我的假设下操作,有没有方法来禁用电源按钮。请让我知道如果我错了。所以,我需要弄清楚如何处理的。显然,如果保持在电源按钮和设备断电再有什么我可以做的。但是,如果电源按钮被点击打开屏幕,然后重新挖掘打开屏幕的背面上,我希望能够处理与适当的。

It all works great. So far, so good. There is only one button I can't seem to disable... the power button. I'm operating under the assumption that there is no way to disable the power button. Please let me know if I'm wrong. So, I need to figure out how to deal with that. Obviously, if the power button is held in and the device is powered down then there is nothing I can do about that. However, if the power button is tapped to turn the screen off and then tapped again to turn the screen back on, I would like to be able to deal with that appropriately.

这是怎么回事的是,应用程序恢复运行,但它不再是全屏显示。显示通知栏。因此,我可以拉下来,并访问Android的其他领域。

What's happening is that the app resumes running, but it is no longer in full screen. The notification bar is displayed. As such, I can pull it down and access other areas of Android.

为什么是它唤醒屏幕在Android设备上引起如上所述的通知栏出现超过配置的全屏幕应用程序...和我怎么prevent呢?

Why is it that waking the screen on the Android device causes the notification bar to appear over a full-screen app configured as described above... and how do I prevent it?

推荐答案

如果问题是布尔:是否有可能重写POWER按钮?答案是肯定的。 请记住,我不是说大约在这样的行为应该或不应该选择或将情况你想达到什么你受益的背景下东西!

If the question is boolean : Is it possible to override POWER button? The answer is YES. Please remember, I am not saying anything about the context in which such a behavior should or should not be chosen or will the situation benefit you in what you are trying to achieve!

压倒性电源按钮有可能在无根的手机(ATLEAST 2.3.5和2.3.6)!如果你不相信我,然后就从谷歌播放下载盗窃意识到免费的应用程序(版本,它得到了收购AVAST前),并检查它自己。我已在无根三星GalaxyŸ测试它(机器人2.3.6)和HTC野火S(安卓2.3.5)。

OVERRIDING POWER BUTTON IS POSSIBLE on non-rooted phones(atleast 2.3.5 and 2.3.6)! If you dont believe me then just download Theft Aware free app from Google play(version before it got acquired by AVAST) and check it out yourself. I have tested it on non-rooted Samsung Galaxy Y (android 2.3.6) and HTC Wildfire-S (android 2.3.5).

我并不是说其可能使用公开记录的Andr​​oid的API,但它有可能在一个无根的工厂的Andr​​oid固件(2.3.5和2.3.6 ATLEAST如果没有其他人)。可能是盗窃意识到球员可能连接到OS水平/反向工程,或挖深入到源$ C ​​$ C,可能已经找到了重写的电源按钮的一些方法,但他们做到了绝对出色。

I AM NOT saying its possible using the publicly documented android APIs but it IS possible on a non-rooted factory android firmware(2.3.5 and 2.3.6 atleast if not others). May be Theft Aware guys might have hooked on to the OS level/Reverse Engineered it or have dug deep into the source code and might have figured out some way of overriding the power button but they did it absolutely brilliantly.

这是他们的知识产权,这是有关于他们怎么做任何文件,或纸或论坛讨论解决方案的原因。我一直在试图找出自己的过去2周。没有成功呢,但如果他们能做到这一点......手段,是可以做到的!

This is their IP and that is the reason there is no document, or paper or forum discussion solution about how they did it. I have been trying to figure it out myself for last 2 weeks. Not successful yet, but if they can do it...means, it can be DONE!

厌倦了读书,它不能做,所以答案。继续寻找,如果有人发现的伎俩,请张贴!

Got tired of reading that it cannot be done, hence the answer. Keep Looking and if someone finds the trick please post it!

P.S:我不是说了一个很好的事情。我不是说你应该禁用电源按钮,结束了一个糟糕的用户体验的应用程序。答案只是说覆盖了电源按钮可能!

P.S : I am not saying its a good thing to do. I am not saying that you should disable power button and end up with a bad user experience app. The answer just STATES that overriding the POWER button IS POSSIBLE!

这篇关于禁用电源按钮......或者......恢复全屏幕的Andr​​oid应用程序,蹒跚学步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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