将用户锁定在特定活动
问题描述:
是否有可能将用户锁定在某个活动中,以至于无法通过输入别针或以其他方式“解锁”而离开该用户?如果是这样,怎么样?将用户锁定在特定活动
对于在公共设置中使用的应用程序(如显示的平板电脑)会非常有用。
答
不能经由home键导航从您的应用程序远(你不能阻止用户停止开放其他活动)。但是,如果通过onPause()回调发生这些情况,则会通知您,如果用户返回给您,则会调用onResume()。您可以在恢复点需要一个pin。
答
它是可能,但涉及很多欺骗。看到商业应用SureLock这可能是你想要的。
如果你想尝试一下自己,开始在AndroidManifest.xml
重新定义主屏幕,使用
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
这会询问用户的权限在第一次调用时。当您还想锁定最近的活动并访问设置菜单时,它会变得复杂。
所以,简短的回答是yes
。
看看http://stackoverflow.com/questions/10625413/is-it-posible-to-use-a-device-to-run-one-application-exclusively/10625480#10625480 – 2013-04-27 05:48:15