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.
Related
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.
I am working on a security app. everything is fine, except there is a backdoor. the security can be easily removed by just uninstalling the app. is there a way i can protect my app from getting uninstalled by intruders? i'm sure this is possible as i have seen apps on google play store which cannot be uninstalled from settings.
Please refer 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.
For example this application is using same functionality.
Make sure if you install above application(SeekDroid) you must sign up then it will ask for device admin permission. :)
We can install an app with administrative privilege in android. This is very much possible. When the app is installed an activity appears showing up "If we want to activate the administrative privilege?"
But my doubt here is, I want the app to be installed with administrative privileges without user explicitly clicking on Activate(which appears when app is installed).
Actually in my app, there is no activity and the main class is extending application. With in the onCreate() of it, I gave necessary code for installing it as administrative privilege app. The app is getting installed and its even getting listed in the
select device administrators (Settings->Location & Security-> Select device administrators)
But, it is not checked by default after the install. Can I check that by default during the install.
Hope I was clear enough. Thanks in advance. :)
Can I check that by default during the install.
No, sorry.
I want the app to be installed with administrative privileges without user explicitly clicking on Activate(which appears when app is installed).
That would be a massive security hole.
I want to create an Application such that if it is uninstalled by user then I want to stop uninstallation of Application.
How I can do this ?
Thanks
You can't. There is no such event in Android. Also you can't stop uninstallation of your or any other app. For this you'll need some permissions that are only granted to system applications.
why? why? why? As a user, if I want to uninstall an app, then I no longer want it, and it should be uninstalled if I am uninstalling it. It should also not be reinstalled unless I exclusively do so.
But there are some applications which we cannot uninstall unless we have a rooted device. Those are the apps like market, Google maps, camera etc which are installed by the manufacturers. You would want to create an app which is so good and useful and then convince the manufacturers or service providers to preinstall the app and prevent the users from uninstalling it. Examples : Swype, Skype, Facebook, Twitter etc
But if the app is a normal app then I would recommend against such a thing.
For your question, you cannot do so unless you are the manufacturer.
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.