Prevent application from being killed on rooted device - android

I am working for an company witch wants to give employes devices that can track them using gps. I want to create a service that won't close in task manager.
Is this possible ?

Your best bet would be implementing a System Service on the device. These are apps which are started on boot and stopped at shutdown. The user won't be able to stop these.
However you will need rooted device with modified Android OS software.
http://ofps.oreilly.com/titles/9781449390501/Android_System_Services.html

I don't think its possible. Any non-system process/app running in android can be killed/stopped. Your best bet would be to restart that service in case it got killed.

From ICS onwards, any app implementing Device Administration cannot be stopped. This is being done for specifically for enterprise customers to have this option. Further you do not even need root access for this.

Related

Android User tracking application which prevent it self from being killed by users

I am working on an Android enterprise application that targets limited mobile devices which help owner to track the user/device status (like GPS, Calls logs) remotely. I managed to implement these basics features to my application. Challenge that I'm facing now is the end users who traveling away with the device can force stop the application or can revoke some permissions(above Marshmallow) to prevent them self from being tracked remotely by the owner.
First of all is it possible to make such an application?
If yes, what are APIs given for such applications development?
Note - All the targeted devices are rooted anything I can get advantage of that.
Is there are any special APIs available for developments of those applications which work only on Rooted devices?
According to your requirement i will suggest you to look deep into the android Service.
As You might also have a look on the persistent service,
You can only make your service persistent if you are developing system apps. This service is basically unkillable.
Here is some write up for persistent service
Hopefully this might help you.
But for non-system applications, startForeground is your best option.

Stop Android Service from another package

Before someone tells me this cannot be done, I have done plenty of research on why on process cannot interfere with one another and under what conditions this is possible. Our problem is that the Bluetooth support between devices is inconsistent and the solution on some devices is to stop the existing Bluetooth service and run a separate app (BlueFTP) which is then able to listen on the freed port and manage OPP communication.
android.permission.RESTART_PACKAGES permission plus ActivityManager.restartPackage() doesn't work as it simply restarts the offending package.
Process.killProcess does not work for the obvious reasons (read the API)
android.permission.KILL_BACKGROUND_PROCESSES permission plus ActivityManager.killBackgroundProcesses() is ignored because (I believe as per the API) the Bluetooth app is not considered a background app and therefore not eligible to be killed.
Currently if a client is having an issue with a specific phone, we get them to go to the running apps and force stop the offending OPP Service before refreshing BlueFTP so that the port listener starts. The offending service has more than one possible name depending on the phone and Android version.
So. The process is currently manual but I was hoping there would be a way to achieve this via code mirroring the force stop option in settings. A lighter option could be to assist in opening the settings for that service rather than needing to explain to clients how to get there, but I'd prefer a complete solution if one is available.
Note that while our the dev phones have root access, the client phones will not.
You can use implicit intents for your services in other apps to close them. It wouldn't need extra permissions as well, unless your service enforces a permission for it's access.
Oh, I overlooked the fact that it's a third party app. In that case, you can't really do much. Sorry.

shut down android device programmatically

I am trying to switch off android device through my program. It actually gets switched off but it restarts itself. I want the phone not to restart again by itself. How can I do that?
This has been asked on StackOverflow in the past. The effective answer is that you would require the DEVICE_POWER permission in order to shut the phone completely off, but the user would need a rooted phone to give your app permission to that control anyway.
Best you could hope for is PowerManager.goToSleep()
I suppose you have found the answer,but this might help other users.
It's not possible to turn off your device.
Here is an easy way to lock it :
Download an application that locks/turns off the screen
Launch it from your application Launch an application from another application on Android
You won't need any permissions, because some are only granted for system apps(like DEVICE_POWER and REBOOT).
You also won't need to root your device.

How do some app make their service running (relaunching it) even after killed ? Can android have any way to boot on power connect?

I have 2 questions:
How do some android app make their service restart even if killed from task manager? A good example is Lookout security app. What I guess is that it has registered for all common events that are announced like app installed - unistalled, interenet available ,etc.
Is this a way to keep your service running ?
Another solution I found was to make 2 services monitoring each other, so if one gets killed restart another.
Which one would be a proper approach ?
Is there any way in android to start booting automatically(if device is switched off) once connected to power source ? I have never heard this on mobile platform.
This is possible for PC through bios feature. Can it be done on android ? Any ideas welcome.
1.) This is simple. All you have to do is return Service.START_STICKY from the services onStart() method. This tells the android OS to resume the service ANY TIME it is killed EXCEPT with a call to stopService()
2.) The only way this is possible is by modifying the firmware of the phone. When the phone is off, the android OS hasn't yet been started so there's no way to create an application that can run before the OS has been booted.
Answering this my own old question ..
By registering for events as well as monitoring on apps may help but since 2.2 adds support for Service.START_STICKY this would rather be better option unless your app can't wait for O.S. to start. ( Like in case its antivirus which needs to be awake all time ).
Not a solution yet. Support may come up if provided an option ( for e.g. like BIOS has this feature for PC ).

How to Lock(Block) an android application from starting / How to stop an android application (service) from starting at boot

I would like to know if there is a way to lock (prevent) an application from starting.
And i also would like to know if there is a way to prevent a service(application) from starting at boot of the device
...i would like to know because i would like to create an anti-malware app.
I know this question is old, but for others stumbling over it:
Autostarts is an application that can disable apps from starting at boot time. It's the best I've found to do that (it isn't resident and doesn't kill processes like a task manager, it actually parses apk packages and reads registered actions and blocks the actions you tell it to). BUT it needs root and hasn't been updated for a while (december 2011). It works on Android 2.3 on which I tested it. Because it was discontinued, I don't know if it works on newer OS versions.
It's commercial now, but that's not the point, you need a peek at the source code.
If you search a bit, you'll be able to find the source code for an older version and see how it implements the blocking system.
I would be very interested in an application that could block certain services. NOT kill, but prevent them from starting in the first place. And the list is quite big: Facebook (OrcaService, MqttPushService, MediaUploadService, BackgroundDetectionService), Twitter, Maps (NetworkInitiatedService), Yahoo Mail Sync, etc. I don't use the features that the services provide, I even disabled some of them in the app interface where possible, but they still pop up and remain resident after exiting the application.
I would like to know if there is a way to lock (prevent) an application from starting.
Not in any supported fashion. Anything that does this is malware, and the techniques for doing it are security holes.
And i also would like to know if there is a way to prevent a service(application) from
starting at boot of the device
The user can boot their phone in safe mode (I forget the exact process, but it's something like holding down the HOME key while turning the phone on).

Categories

Resources