What's the mechanism of locking access to selected applications in Android? - android

I'm trying to find out how applications like Perfect App Protector or Smart Applock Free work.
What mechanism is used?

These applications use a service to monitor whether a new application is trying to launch or not.
It can be done in several ways. If running application matched with the configured application then it is sent back to the background by the service and may ask for lock code, password as you configured earlier. If it matches then you will get the application on the foreground. Otherwise it kills the process from being executed.

Related

Keep Flutter application active on device at all times, possible?

A client of mine is requesting for a very specific functionality, to keep the application always active, even after the user force kills it. He wants to ensure that the users have the application active at any time while using the device on which it is installed (the devices are managed in a constrained environment).
I've done some research on it, and already enabled background services for sending the user's location, but if they force kill the app then we are unable to send locations to the server. We've seen other apps do it, but wonder how they do it.
According to https://stackoverflow.com/a/34573169/640907 it should be possible in Android. We also found https://ssaurel.medium.com/how-to-auto-restart-an-android-application-after-a-crash-or-a-force-close-error-1a361677c0ce but I don't think this will work for our use-case, as the user can close the application without "force kill" aswell..
Anyone knows how to achieve this for a Flutter application?

Android Oreo: Is there any way to auto - start the application on mobile reboot?

I am developing an application for a business entity. That application should run in the background in every employees' mobile phone. Employees are mostly salesman. The application basically detects location changes and suggest the salesman where they might visit. A kind of reminder application. It also lets other salesmen see where are their teammates.
Right now I am using a foreground activity and it works fine till the system forcefully doesn't kill the service or the phone doesn't reboot due to manual activity or battery discharge.
Ones the application is closed, as of now, the managers in the firm needs to call salespeople to turn on the application once, as on application start it automatically turn on its foreground service. But this is really an extra burden on the management team which can be automated.
I am ok to have any settings based or code based solution. One solution is to root the phones of salespeople and install some extra utility app or write the code based on root APIs, but this will be too much for this simple task.
THe permission RECEIVE_BOOT_COMPLETED was not added properly in the manifest. After adding the permission it worked calmly. In on receive method of the broadcast receiver, I am starting the foreground service.
At the moment, the best way is to use WorkManager https://developer.android.com/topic/libraries/architecture/workmanager/ Yes, it still alpha, but works very good.
From other side, you could work on automating the task "managers in the firm needs to call salespeople to turn on the application once". I mean, an app/backend could automatically call the salesman (with some pre-recorded message) or send SMS to them.

Android- programmatically restrict which apps can be run

I'm building an app that needs to restrict which apps can be run along with it.
In example, when my app is running (foreground or background) I can allow user to run only GoogleMaps, and MusicPlayer.
I've read a bit about Device Policy Controller and creating profiles, and up to some point it seems to have the feature I need, but it is designed for enterprise deployment, and user needs to encrypt their phone beforehand. Is creating personalized profiles a way to go?
My other idea was to run a service that each few milliseconds check if there is any forbidden app running and finish it, but it seems to be not robust.
Is there any way of handling this problem programmatically?
I don't think that Device Policy Controller is a right thing for you.
And you can't just kill other apps without root.
So some kind of user-friendly way to achieve the goal is to check running apps list with ActivityManager.getRunningAppProcesses and to notify user that he has to finish particular apps to use your app.

How can I detect that a particular application has been launched?

The Context
There's a certain app that competes with my app for a hardware resource that should be mutex-locked, but isn't. The hardware resource has no API in the public Android SDK, and the competing app expects to be the only app to ever need it. The hardware resource's governing firmware also expects it to only ever be acquired by one app at a time.
The Problem
Collisions over the hardware resource are not handled well in the firmware, and my test device will often need a reboot if the user launches the competing app while my app is running (I'm able to check for the competing app's service with ActivityManager.getRunningServices() and stop my app from trying to acquire the hardware resources if the user starts my app while the competing app is running).
I don't have access to the competing app's source code, or the system image source code, so my app has to be responsible for handling the competing app's bad behavior and/or the firmware's poor handling of competition for this hardware resource.
The Question
Is there a way for a normal (i.e. non-system) app running on Android Marshmallow to receive a callback when an app Activity or Service with a known component name is launched?
Is there a way for a normal (i.e. non-system) app running on Android Marshmallow to receive a callback when an app Activity or Service with a known component name is launched?
No. In fact, Android 5.0+ takes pains to hide the real-time knowledge of other running apps from you, for privacy and security reasons.

Disable intents registered by other apps

I want to disable/unregister intents registered by other apps so that they would not get broadcast messages sent by the system?
Something like this:
Gemini app
(3rd screenshot)
Is there any similar app with the open source code?
Also, it is possible to remove permissions registered by another app?
I want to disable/unregister intents registered by other apps so that they would not get broadcast messages sent by the system?
Fortunately, that is not possible, except on rooted devices.
Something like this: Gemini app (3rd screenshot)
As the app notes, this requires root.
Also, it is possible to remove permissions registered by another app?
As JonTraex notes in his linked-to answer, this is not possible even with root.
I answered a similar question here:
https://stackoverflow.com/a/9106832/529691
If you had bothered to look at their permissions you could see how they are doing it.
SYSTEM TOOLS
KILL BACKGROUND PROCESSES Allows an application to kill background
processes of other applications, even if memory isn't low.
KILL BACKGROUND PROCESSES Allows an application to kill background
processes of other applications, even if memory isn't low.
FORCE STOP OTHER APPLICATIONS Allows an application to forcibly stop
other applications.
MEASURE APPLICATION STORAGE SPACE Allows an application to retrieve
its code, data, and cache sizes

Categories

Resources