如何使应用程序不可关闭? [英] How to make an app unclosable?

查看:199
本文介绍了如何使应用程序不可关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我不希望他们能够全身而退。因此,当他们preSS家庭或后退按钮不会让他们退出该应用程序。我知道有使用服务来保持应用始终在后台运行的方式,但我甚至不希望它们甚至退出。

After a user opens my application I don't want them to be able to get out. So when they press the home or back button it doesn't let them exit the app. I know there are ways using a service to keep the app always running in the background, but I don't even want them to even exit.

这甚至可能,如果又如何?无需修改内核。

Is this even possible, if so how? Without having to hack the kernel.

我知道这听起​​来很奇怪,但它不是一个商业应用程序,但是对于我的实验室,它永远不会是上GOOGLEPLAY。该平板电脑将给予小孩子,他们将参加考试就可以了,所以他们使用YouTube或其他任何东西我不能要。

I know this sounds odd, but it is not for a commercial app, but for my lab, it will never be on GooglePlay. The tablets will be given to little kids and they will take a test on it, so I can't have them using youtube or anything else.

相关岗位:<一href=\"http://stackoverflow.com/questions/11746875/android-how-to-make-the-task-of-the-app-unclosable-only-closable-by-task-killi\">Android,如何使应用程序的任务不可关闭?只有通过任务可关闭杀

CommonWare 答案似​​乎表明,内核黑客是唯一的出路,但果真如此吗?

The answer by CommonWare seems to indicate that kernel hacking is the only way, but is it?

另外,我使用的的Andr​​oid→

推荐答案

有没有官方的支持,但 - 会有通过任务锁定API

there is no official support yet - there will be support with android L via the Task locking API

第l开发preVIEW引入了一个新的任务锁定API,允许
  您暂时离开你的应用程序或正在限制用户
  由通知中断。这可以用来,例如,如果
  正在开发一种教育应用程序,支持高风险评估
  Android上的要求。一旦程序启动此模式下,用户会
  无法看到通知,访问其他应用程序,或返回到
  主屏幕上,直到你的应用程序退出模式。

The L Developer Preview introduces a new task locking API that lets you temporarily restrict users from leaving your app or being interrupted by notifications. This could be used, for example, if you are developing an education app to support high stakes assessment requirements on Android. Once your app activates this mode, users will not be able to see notifications, access other apps, or return to the Home screen, until your app exits the mode.

https://developer.android.com/$p$pview/ API-overview.html

编辑:正如你说你用左旋这让过时的 - 但我在这里把它作为对他人的提示

as you said you use L this got obsolete - but I leave it here as a hint for others

说 - 你还可以,如果你要(例如kiosk模式的应用上有一定的硬件),以获得这方面的工作没有根今天。它不是简单 - 没有解决方案,对所有设备的工作 - 但如果你需要它,你可以得到它像招数工作:
  - 反应的主屏意图(并将其设置为默认)
  - 当你去后台 - 再提起你的自我前景
  - ..

said that - you are also able to get this kind of work without root today if you have to ( e.g. kiosk mode app on a certain hardware ). It is not simple - and no solution that works for all devices - but if you need it you can get it work with tricks like: - reacting on home-screen intent ( and setting it as default ) - when you go to background - bring your self foreground again - ..

这篇关于如何使应用程序不可关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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