如何实现在Android的一个应用程序更衣室? [英] How to implement an app locker in android?

查看:131
本文介绍了如何实现在Android的一个应用程序更衣室?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有任何不满意为Android应用程序更衣室节目,我已经找到,并想创建自己的,但我有麻烦搞清楚如何实现实际的锁。一个人如何去实现一个应用程序更衣室为Android?

I am not satisfied with any of the app locker programs for Android that I have found and would like to create my own, but I am having trouble figuring out how to implement the actual lock. How does one go about implementing an app locker for Android?

有两个问题:

  1. 检测的意图,通常从启动调用startActivity()或从广告启动市场的应用程序(我不是在谈论广播意图 - 我需要处理明确的活动意图)。

  1. Detecting an Intent, usually from the launcher calling startActivity() or from an ad launching the market app (I'm not talking about broadcast intents -- I need to handle explicit Activity Intents).

  • 对我都看见了更衣室的应用程序的权限有读取系统日志文件和/或检索正在运行的应用程序,这意味着他们可能会使用轮询来寻找应用程序启动。我想我能做到这一点,但我想找到的话可能更好的解决方案。

$ P $的处理意向pventing锁定的应用程序。我想preFER不允许锁定的应用程序运行在所有,直到通code进入,因为它是不可能告诉它可能做的,当它启动。

Preventing the locked app from processing the Intent. I would prefer not to allow the locked app to run at all until the passcode is entered since it is impossible to tell what it might do when it starts up.

  • 在运行时我目前的应用程序更衣室,logcat中显示ActivityManager:启动活动先用意图锁定应用程序,然后再次与意图的应用程序更衣室,什么也没有在两者之间(以10-20ms分隔)。如果我输入正确的传球code,然后我看到ActivityManager:moveTaskToBack。
  • 我已经尝试了一个测试应用程序,它表明,使用我目前的应用程序更衣室,没有任何活动的回调被调用,如果应用程序被锁定,我不输入正确的传球code。因此,它似乎是$ P $启动pventing应用程序(但我不知道如何)。
  • 我可以使用ActivityManager.kil​​lBackgroundProcesses()停止一个应用程序,但我不能保证程序尚未开始通过它得到封杀的时候运行。
  • 我也许可以使用PackageManager.setApplicationEnabledSetting(),以prevent一个应用程序中实例化,但我不认为这会采取已经在运行的应用程序的照顾(这不应该被允许的过程新的意图,或来到前台)。我也许能使用killBackgroundProcesses()停止所有正在运行的进程锁定,使他们将不得不重新实例。但我不喜欢这种方法,因为其他应用程序可能会惹启用设置,并打败了锁。
  • 在理想情况下,该系统将发送的每一份意向书,以我的应用程序进行检查,并让我停止或让它通过,但我pretty的肯定是不可能的(至少不是明确的意图开始活动从发射)。

有谁知道如何应用程序更衣室应用程序来实现,或者有什么好主意,它如何可以这样做?

Does anyone know how app locker apps are implemented, or have any bright ideas on how it could be done?

推荐答案

我会考虑的生命周期。一旦有问题的应用程序开始加载,从该包中的一些活动将被添加到前列活性。

I would look into the lifecycle. Once the app in question begins to load, some activity from that package will be added to the forefront activity.

的变化,最前沿的活动扫描可能做的伎俩。

A scan of the changes in forefront activities might do the trick.

http://developer.android.com/reference/android/app/Activity.html#ProcessLifecycle

这篇关于如何实现在Android的一个应用程序更衣室?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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