本文介绍了从开始prevent Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了很多问题,是否有可能prevent启动一个Android应用程序,但所有的答案似乎是不,你不能。

I have read many question about whether it is possible to prevent an Android application from starting, but all of the answers seem to be "no, you cannot".

的想法是很简单的:我们希望用户能够使用一restrited组应用程序,就可以pinstalled他的移动设备上$ P $。如果用户试图启动非授权的应用程序,他将出现一个提示对话框,要求输入PIN。如果他进入正确的密码,那么他就能够运行应用程序。否则,应用程序将无法运行。

The idea is very simple: we want the user to be able to use a restrited set of applications that will be preinstalled on his mobile device. If the user tries to start a non authorized application, he will be prompted with a dialog asking for a PIN. If he enters the right PIN, then he will be able to run the application. Otherwise, the application will not be run.

正如我之前说的,所有我能找到那里的答案分为两类:你不能这样做和你可以做到这一点通过书面方式自己启动应用程序

As I said before, all the answers that I could find out there fall into two categories: "you can't do that" and "you can do that by writting your own launcher application".

不过,我已经看到了应用,如ZDBox,让您做到这一点。也就是说,ZDBox你可以定义非授权的应用程序,以这样一种方式,如果用户试图启动其中的一个,他将需要输入PIN真正启动应用程序。如果他不能提供的,该应用程序将无法启动。有趣的是,ZDBox不需要root访问权限做到这一点。

However, I have seen applications such as ZDBox, which allow you to do just that. That is, with ZDBox you can define "non authorized" apps, in such a way that if the user tries to start one of them, he will need to enter a PIN to actually start the app. If he fails to provide one, the app will not start. The funny thing is that ZDBox does not require root access to do this.

所以我的问题是,我们如何才能起价启动P $ pvent其他应用程序,就像ZDBox呢?

So my question is, how can we prevent other apps from starting, just as ZDBox does?

推荐答案

选项1

所有我见过涉及运行你的应用程序作为一个启动/主屏幕更换的例子。这是怎么回事呢童锁风格应用程序我用的工作。这具有的优点

All the examples I've seen involve running your app as a Launcher/Home Screen replacement. This is how all the child lock style apps I've used work. This has the advantage

  • pressing主页按钮不离开应用程序
  • 您有应用程序的控制发射

您可以检查出的Andr​​oid的launcher2 code,看看Android的启动工作。 https://android.googlesource.com/platform/packages/apps/Launcher2.git

You can check out the android Launcher2 code to see how the Android launcher works. https://android.googlesource.com/platform/packages/apps/Launcher2.git

选项2

目前看起来是一个选择,我可以看到。在这你可以尝试阅读的logcat项检测时,被列入黑名单的应用程序启动或提请前景,然后启动您的应用程序在上面。

There does look to be one alternative that I can see. In that you can try and read the logcat entries to detect when a blacklisted app is launched or brought to foreground and then launch your app over the top.

类似的他们是如何检测应用程序启动的How当用户启动另一个应用程序来检测? (安卓)

Similar to how they detect an app launch in How to detect when the user launches another app? (Android)

这篇关于从开始prevent Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 11:40