How to uninstall app which is set by password? - android

I developed one parent and child communication Android application in which I wanted to restrict the child from uninstalling application. I have one solution that uses DevicePolicyManager. But still the application can be uninstalled without asking for password. If I remove the Device Administrator permission from the settings, then application is uninstalled from device?
Can anyone provide the valid solution for this cause?

You cannot prevent a user from uninstalling an app, from within the app code itself.
There is suggestions here How to prevent an application from being uninstalled?, but they are not foolproof.
The way around this is to use an android device with lollipop and upwards, so you can create a user account.
On the admin account, install an app that requires a password to uninstall apps. They are on the market (and free) I've used them. Or write one yourself.
Then on the child's account allow them whatever privileges you want them to have. They will be unable to touch the apps and uninstall them, unless on the admin account and with the password required for that app to uninstall other apps.
I have tried and tested this and it works.

Related

Is there a way to prevent a user to uninstall an app?

I'm making an android anti-thief app. I want to prevent a thief to uninstall the anti-thief app.
The app is a device administrator. So I used DeviceAdminReceiver.onDisabled
to start a “always on top” password prompt Activity (the password is setup by the user during the app configuration). This works fine.
But, Google Play rejected the app. Email extract:
Read through the Device and Network Abuse policy and make the
appropriate changes to your app. You’ll need to remove any
functionality that prevents a user from removing or uninstalling the
app from their device.
My Question:
What other ways can I use to prevent unauthorized user to:
uninstall my device administrator app ?
disable the device administrator permission ?
Thanks
EDIT: reformulate the question to clarify that the question is not about google play policy, but about alternative implementation.

Android permissions not requested after reinstall

I am testing my Android app on my own phone. When I first run it on my phone, it asks for permission to user my gmail account. When I reinstall my app, it no longer does that? I would like to make it so that it re-requests permission every time I reinstall the app for testing purposes. If, on the other hand, I change the package name, it re-requests the permission. Does anyone know how to do that? Much help would be appreciated!
Thanks!
Note: By reinstall, I mean both pressing the run button and actually resinstalling the application by first uninstalling via settings.
This is not an actual Android permission, it's actually an account access grant specific to AccountManager. Technically, when you uninstall an app all grants should be cleared, but this appears broken on some devices. If you have a rooted device or are using the emulator, you can find accounts.db (usually in /data/system/users/0/accounts.db on newer versions) and clear the grants and extras tables (that could affect other apps, so handle with care). If you don't, clearing the data for Google Account Manager and Google Play Services could help.
What do you mean by reinstall? Does reinstall simply meaning pressing the "run" button? Or are you actually uninstalling and reinstalling the application. Once the Android OS detects that a permission is needed, it will request it from the user. But after that first time, it won't ask again. If you completely uninstall the application from the device and then reinstall, it should work. I don't know of any other way you can bypass that.

Make android app non erasable

Is is possible to make an android app non deletable.. What i mean is, I want to install a app, but I cant remove/ uninstall it. If I want to uninstall it then it should prompt me for password which I would have set during installation of the app.
When I read the docs they tell it can be done using Device Admin, but it doesnt provide security, interms of it doesn't ask the user for the password and deletes if its correct..
Is it possible to make an app such that even if there is a factory reset the app will still be there on the phone ?
Is is possible to make an android app non deletable
No, unless you want to create your own ROM and preload it with your app, just like some manufactures preload their devices with their own software and other bloatware.
No it is possible to restrict any user to delete the app from android device.
As google already maintaining this scenario by using the concept known as Device Management System.
Google Eyeing on apps which are published by the developer / installed or deleted by the user.
Although you can make your own app which will notify your admin that user is trying to delete the app or deleted the app, using Service Intent concept.

How to prevent an application from being uninstalled?

I'm developing an application for parents to watch out for their children. So this application cannot be removed by the child. I need to know how to make it uninstallable or the user need password to remove that application.
Ankur,
I think the closest thing to what your looking for is the Device Administration feature introduced in 2.2.
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.
While the Device Admin API doesn't allow for password protection of this particular feature, you can password protect your application to prevent someone from tampering with the Device Admin features in the app.
I use an app called SeekDroid that has a similar functionality.
I've only seen one app that does this, its called Prey and is used to track lost phones and computers. The project is open source so you could go through their code and see how they do it or contact the developer and maybe they'll tell you how they do it.

Silent Uninstallation

I am working for manufacture of cell phones. we develop for the Android platform, therefore we can sign our applications and have system permissions, for example we can use
the packagemanager.installPackage(|..) method, which gives us the ability to install APK's without the user involvement.
I would like to know, if any one you know about an Un-instantiation method which would uninstall apk's silently without user-involvement?
thanks,
ray.
There is functionality in there some where to do this - Google uses remote kill switch to uninstall Android apps, but I haven't seen any details on where you would find this. But as a user I would be very unhappy with a handset which silently removed apps without telling me - even if the app was a security threat, if I had installed it, I would want to be told it was being removed.

Categories

Resources