禁用主页按钮的Andr​​oid ICS(4.0) [英] Disable Home Button in Android ICS (4.0)

查看:168
本文介绍了禁用主页按钮的Andr​​oid ICS(4.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个专用的应用程序的公司,永远不会释放它到Android Market(或Play商店现在我猜)的冰淇淋三明治(Android 4.0的)。

I am making a proprietary app for a company which will never release it to the Android Market (or Play Store I guess now) in Ice Cream Sandwich (Android 4.0).

我需要禁用回家,所以用户无法卸载恶意软件或删除数据的应用程序捕获。这个最新版本是第一个被写在4.0,previous版本写在2.2和3.2。

I need to disable the Home so the users cannot maliciously uninstall software or delete the data that the app captures. This latest version is the first to be written in 4.0, the previous versions were written in 2.2 and 3.2.

有关禁止在2.2 Home键,我相关联的应用程序作为一个家庭更换,使按键刚刚重新开放的应用程序,但我不能再使用此方法,因为这有点prevents我们做我们的更新应用程序(我们不希望给用户重新选择一个Home默认的选项,因为这将导致数据删除。

For disabling the Home button in 2.2, I associated the app as a home replacement, so the button just reopened the app, but I can no longer use this method, as that somewhat prevents us from doing our updates to the app (we don't want to give the user the option of reselecting a Home default, as that would lead to data deletion.

在code我有disableing的主页按钮3.2是:

The code I have for disableing the Home button in 3.2 is:

@Override
public void onAttachedToWindow() {
     getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
     this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
     super.onAttachedToWindow();
}

和,的onCreate下:

and, under onCreate:

KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();

但是,当我跑在我的3.2的平板电脑,工作同code,它不会对我的4.0平板工作。

But when I run the same code that worked on my 3.2 tablet, it does not work on my 4.0 tablet.

我在想,如果有一个新的API或方法4.0已经将达到同样的效果,因为我目前在我的3.2执行。

I was wondering if there is a new API or method that 4.0 has that will accomplish the same effect as I currently have in my 3.2 implementation.

感谢您的帮助和指导。

亚当

推荐答案

怎么样的解决方法。

写第二个应用程序,实现了主屏幕,在主屏幕按钮pssed这个程序将来到前台$ P $。从这个程序,你则需要将主要的应用程序推回前台。唯一的缺点是,你的主屏幕上的应用程序必须永远需要更新,但你应该能够自由地更新主应用程序没有标签要求设定居住地启动。

Write a second app that implements the home screen, when the home screen button is pressed this app will come to the foreground. From this app you then need to push your main app back to the foreground. The only catch is that your Home screen app must never need an update, but you should be able to update the main app freely without the tab asking to set the home launcher.

希望是有道理的。

这篇关于禁用主页按钮的Andr​​oid ICS(4.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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