How to prevent an application from being uninstalled. How to stop it using code when user want to delete the application ? How can we do that using programming ?
One possible way may be android os customization. Otherwise I think you can't do this. You can see this Stop uninstallation of application
Without customization, you can get a message(using intent) when user try to uninstall a package.
Device Administrator
Once the application is registered as a Device Administrator, it can't be uninstalled unless its unregistered. This will prevent the app from being uninstalled
You should look at Device Administration .
Once the application is registered as a Device Administrator, it can't be uninstalled unless its unregistered. This will prevent the app from being uninstalled.
You can password protect your application to prevent someone from tampering with the Device Admin features in the app.
Please read this example. It is explaining all the details with sample tutorial.
Related
so I'm developing an application locker. Ive developed the core locking functionality. i want to add the functionality of preventing an unauthorized user from uninstalling any locked apps on the device. What i want to do is when a particular app is locked and someone tries to uninstall it,i want to show my locking screen first.If the user enters the right password then he /she should be able to uninstall the application. Ive seen other applications like AppLock and McAfee Antivirus having this functionality. can anybody advice me on how to achieve this functionality. Thank you in advance
You can track the uninstallation of app by implementing Device Admin API
you can use wipedata() method of device admin api
I need to create a app which is responsible for closing the other apps which are currently running in background , is it possible ? Can I want close the other apps ? if it is possible then how ? plz help
Unless the other apps are signed by the same certificate, you cannot do this. The system apps (like Settings, with which you can "force stop" any app) have special privileges that are not allowed for apps written by developers.
I hesitate to ask, but why would you want to do such a thing?
Just want to know how to track what applications a user has uninstalled from their device in the past.
There is no log available that you can read way after the apps have been uninstalled (afaik).
All you can do is listen for the ACTION_PACKAGE_REMOVED broadcast while your own app is installed. It contains the package name of an app that the user just uninstalled.
There is no record of that on the phone/device and even if there would be it would not be available to a non-root application.
I am making one phone security application in android.
The point where I stuck is that How to set uninstall password for this app.
When application is installed user can set the security password and this password will be used for uninstalling this app.
So please someone suggest me how to put code for uninstall event.?
Is there any event or service called when apps are going to uninstall.?
No, sadly there is no uninstall event that you can catch for your own app.
You can only watch the installation and uninstallation of other apps via the Intent.ACTION_PACKAGE_ADDED (and similar) broadcast(s).
Maybe you can use a deamon runing in background, that can intercept the uninstall of you application.
This deamon would be executed when the phone turns on, or when your application is used.
To run an application when booting your phone: http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/
Refer to Intent.ACTION_PACKAGE_ADDED (and similar) broadcast(s) as alextsc said. (sorry cannot add comments)
android does not give you freedom to perform code when app is uninstalled.
All the settings and application data is deleted which is set by the applicaion
The only thing that will persist is the data that is written to the SD-Card and the changes to phone settings
Just wanted to know is there a way to protect an application from getting uninstalled. I know it's possible if i add the application as a device administrator but this is not enough.
Is there a way I could pop up a message asking for the security code before un-installation starts ? any ideas highly appreciated.
You can create two applications. The first will be you application and the second will listen for remove intents and will triger an action if your first applications is removed, but this is only a basic protection since the user can remove the second application first.
The only possible solution is to modify the android source. As there are applications that can't be removed (gmail, contacts, telefon app, sms app, facebook, twitter) there must be a flag that you can use for your requirement. But I doubt that there is a way on a non customized android os...
I think it's impossible If application is installed by user.
Application can be uninstall by user too.
I think "application protection" on the market do what you want.
Try to implement an BroadCastReceiver listen ACTION_PACKAGE_REMOVED.