Prevent Android application from starting - 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".
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".
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.
So my question is, how can we prevent other apps from starting, just as ZDBox does?

Option 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 Home button doesn't leave the app
You have control of app launching
You can check out the android Launcher2 code to see how the Android launcher works. https://android.googlesource.com/platform/packages/apps/Launcher2.git
Option 2
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.
Similar to how they detect an app launch in How to detect when the user launches another app? (Android)

Related

How to programmatically open an app if the user has not opened it even once?

Is it possible for an app to get launched from code even if user has not opened once after installing.
I have tried boot complete listener , package install/ uninstall receiver.
But even these receivers are not working when user has not opened the app at all. I am asking to just check if some one else in the community has tried this before.
The answer is: no.
If the user has never opened your application before, it is not possible to start the application.
On some devices though, it is possible that another second application under your control could possibly start your application, although it has never been opened before by the user.
If you do not have a second application on the device, the answer is no.

How to determine which Apps are launched most by the user?

I am trying to build a sort of launcher.
I would like to have the possibility to present to the user the apps he uses most.
Is there any way to determine which Apps are launched more often by the user?
I am not aware of any system "counter" that does that, and I have found nothing in the documentation and in SO.
There is no way to get this information from the OS, because of privacy concerns. You can start collecting this information when people install your launcher and start using to launch apps, because you'll know which apps they start, but you have to start with some common list of apps initially, which likely will be useless to your users. You can also import their current home screen from the Launcher (and TouchWiz, and HTC Sense), but that does not scale easily for all possible launchers people might be currently using (Nova, GO Launcher, Facebook Home, and so on).
If you are creating an Android launcher, then you are responsible for displaying the android Applications installed and while clicking on the application icon that you listed, you are the one who is opening up the clicked app. So you can keep the count whenever you open a particular app and do accordingly.
Whenever you open an application, just save an open counter against the application package name of the app that you opened.

Android: Prevent users from launching apps or using the OS

Is it possible to have an application run on a device in such a way that it is the only application that can ever run and also prevent the user from using the operating system at all? Tapping on the Home key or Back button would not exit the application and allow the user to have access to anything. If the device boots up, only this application would run.
This would be desirable in situations where devices are installed at a business for point of sales purpose or possibly where the device acts like a terminal in public places.
You can achieve what you're describing by writing your app to replace the home screen (Launcher). From there, you control what other apps will run.
The Android SDK has a working Launcher project you can start from.
Be careful to allow some method of running a more powerful app (even if it's just enabling ADB access) -- otherwise you could leave your device in a state of needing a factory reset before it can be modified.
Yes, you can override the back and home button behaviour.
Start app, override all buttons, and the user cant exit the app, evil, but should work in your scenario.
info here

Password Protect the Applications Button

How can I password protect the Applications button on my Home of my android phone (samsung galaxy s captivate).
I know there is password protect application out there with a list of application you need to add but I don't want that. I want to protect the whole access of the applications.
I'm pretty sure that blocking access to an application from the Home Screen isn't common practice, actually I think you can't even control this as it's part of the Android OS itself. After all, what's the point in blocking user access at the Home Screen since the user already has to unlock his phone in order to get there... usually trough a password.
A viable option would be to greet your users on a Login Activity and you'd have them identify themselves before they can access the actual Application functionality.
If you really want to start blocking users at the Home Screen, you're probably looking at creating your own ROM and Application. But then, no one will want to re-do their whole OS simply to run your application.
Write your own home screen, one that prevents launching any applications unless the user authenticates.

Force application to front

The question I'm about to ask may seem dangerous for the user, so here's the story before the question:
I'm working in a compagny that tries to sell Galaxy Tabs to schools (children under 10). So, I've been asked to develop an application that starts on boot showing a login screen. The child HAS to log in before he's allowed to use the tablet (just like logging in a computer).
My application starts on boot, shows the login screen, all buttons are blocked (the kid must not be able to use the tablet before the application lets him) except the home button.
fortunately, it seems impossible to block the home button.
I've been trying to rebring the application to front when onpause/onstop is called, this kind of hacks.
So my question is : Can I prevent an user to quit my application until I let him do so?
I know this sounds like a virus, I'm not really happy to be looking for this kind of solution either.
You have to build a custom Home screen, and then set it as the default Home application.
EDIT: see more on this previously asked question (at How can I create a custom home-screen replacement application for Android?). You can just make your authorization the default Home application, then when they log in it forwards to the regular Home screen. If they hit the home button your app gets called, can check if they have logged in and if they have will just send them to the regular home screen.

Categories

Resources