This question already has answers here:
Disable DeviceAdmin from shell?
(3 answers)
Closed 4 years ago.
I have installed quick heal mobile security on my android device(Micromax Canvas A110) android version 4.1.4. I am trying to uninstall it, but not able to do so. After further googling, I found out that we would have to deactivate it from device administrator menu in settings.
I tried doing it, only to find that the window with options "cancel" and "deactivate" does not go away on clicking the "deactivate" button.
I tried to uninstall the app using the adb uninstall command after finding out the installed packages using: adb shell pm list packages which gave quick heal's package name as com.quickheal.platform.
But adb uninstall com.quickheal.platform command gives Failure
So how do I do it using adb?
I'm afraid there is no way to deactivate the device admin via adb. There has been made a proposal to open the device admin settings for quicker access in this post:
adb shell am start -S "com.android.settings/.Settings\$DeviceAdminSettingsActivity"
... however there is still some interaction needed.
On some devices the device administrator activity is not properly updated after confirmation in the dialog. So try to exit the settings menu completely and check whether it was just an UI issue.
Addition: according to comments below, it is possible to remove the device admin, if android:testOnly="true" or is missing from the AndroidManifest.xml file. Thx for the note!
just execute this code in your app!
DevicePolicyManager mDPM = (DevicePolicyManager) this.getSystemService(Context.DEVICE_POLICY_SERVICE);
mDPM.clearDeviceOwnerApp(getPackage());
This is possible, although it requires a rooted device (su access), and is a little messy. It involves doing a search for the app via its fully qualified name, and manually removing (rm -f) each found entry.
See articulated answer here: https://stackoverflow.com/a/29093349/3063884
Related
I'm trying to hide/disable an app using pm hide com.myapp but I'm getting an error Error: java.lang.SecurityException: Neither user 10225 nor current process has android.permission.MANAGE_USERS.
I'm using an unrooted phone could anyone tell me why I can't use pm hide or if there's another command I can use
In case anyone is still looking for an answer to this, disabling OEM bloatware through adb is still possible on Android M+ using pm uninstall. While its true that uninstalling a system app requires root access, you can however uninstall the app for a particular user (yourself or user 0) without any root like this:
pm uninstall --user 0 com.micromax.trendingapps
But be careful and make absolutely sure that its a bloatware you are uninstalling because the above changes are permanent! You may not undo the damage done to a system app without factory resetting your device again.
Android disabled this feature in some security update in android 6
I need to launch an app which is in different work profile (Android For Work). If install the app in personal profile then I am able to launch the app from the personal profile on the same device.
However, When I install the app only in the work profile then I am not able to launch the app through adb command.
As per my understanding, google keeps two different containers for personal and work profile. I think the work profile has different space and adb does not have any access to that app and workspace of work profile.
I need to launch the app through appium
If anyone has the answer to the above problem, please answer. Thanks in Advance !
Do you mean launching application on different user account ? check this link please : https://stackoverflow.com/a/24093533/5093606
You can get try to get list of accounts using
adb shell pm list users
and if you working account is there, try
adb shell am start --user WORKING_ACCOUNT com.example.MainActivity
Yes, there is way to launch the apps by using Appium/Adb commands. Instead of appium use adb commands to launch the apps.
The app which you have used for AndroidForWork enrollment, it should be in android:debuggable mode. Set debuggable mode to true and build the apk.
Once the device is enrolled/Configured Androidfor work then get the list of users.
adb shell pm list users UserInfo{0:Drew:13} running UserInfo{10:Work profile:30} running
Get the workprofile user id. In this case 10 is the id. Use the user id to launch the apps.
adb shell am start --user 10 -n "com.android.vending/com.google.android.finsky.activities.MainActivity"
Note: If the provision app is not enabled in Debug mode then you don't have the access to the work profile user.
Turns out I was able to accomplish this with Appium Desktop by adding another parameter to the inspector:
optionalIntentArguments text --user 12
Where '12' is the work profile id you'd see from typing this:
adb -d shell pm list users
Users:
UserInfo{0:Ken Corey:13} running
UserInfo{12:Workspace:50100030} running
Is it possible to disable the "grant/deny" popup dialog when my app needs to perform tasks that require root access? I have full control of the device the app will run on (internal project), the device is rooted and it has supersu 2.x app.
This tells me that I need to declare the android.permission.ACCESS_SUPERUSER permission for my app to disable the popup, but it has no effect.
Is there a simple way to solve this (without changing the option i supersu app settings)?
Remove the SuperSU APK (usually either /system/app/Superuser.apk or /data/app/eu.chainfire.supersu*.apk or /system/app/SuperSU/SuperSU.apk) and rm -rf the /data/data/eu.chainfire.supersu directory, and the su command will always grant access without showing the prompt.
If you're making a custom firmware image for your project, just exclude the APK.
Note that pm path eu.chainfire.supersu from an adb shell will give you the exact path for the APK.
You can't decide in you app to disable the prompt. That's a security measure which no app can change.
If your device is rooted and you have supersu, you can still get rid of the dialog. You have to change a setting in supersu: Settings --> Access --> Default access --> Grant
This is not possible, you can't interfere with the logic of another app, i.e. the one showing the popup when su is accessed (for example Superuser).
I've created a sample project using BackupRestore. I went to register for a key at Android Backup Service. I got the following:
Your key is:
AEdPqrEAAAAIW4p30C1GTNjzBOqWrb0clI7_OCWxm3ddIgkKhw
This key is good for the app with the package name:
com.example.android.backuprestore
Provide this key in your AndroidManifest.xml file with the following element,
placed inside the <application> element:
<meta-data android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIW4p30C1GTNjzBOqWrb0clI7_OCWxm3ddIgkKhw" />
When I launch the app and choose "Bacon" + "Tomato", I can see pending backups using dumpsys backup. So I force run it (bgmr run => pendings disappear) and uninstall the app.
When I restore it, logcat tells me "No restore data available" and of course, the settings aren't displayed with the correct info.
Any ideas what I could be doing wrong ?
When you uninstall the app the backup data got removed. Lookup logs for
BackupManagerService: Removing backed-up knowledge of <app package>
Seems that backup/restore process can vary from manufacturer and device. Testing Backup and Restore document can simple work by uninstalling and installing using a nexus device, but I would not expect the same behavior and consistency on every device.
See also this answer https://stackoverflow.com/a/13648673/1598308
Had the same error, only years later. It's probably because you are using Google Transport instead of LocalTransport. Google imposes a rate limit of 24 hours for every backup, so it's trying to create a backup, but it doesn't, and the restore fails.
Run adb shell bmgr list transports to see the transports.
Run adb shell bmgr transport android/com.android.internal.backup.LocalTransport to change the transport to Local.
Sometime just after I launched a new emulator, for very first time I was trying to upload my apk, however I got "emulator: ERROR: the user data image is used by another emulator. aborting".
I launched a new emulator, and left it alone, several minutes later, DDMS showed "device offline".
I had to restart a new one, you know, minutes wasted.
It's really bothering that I keep getting this error and slowed down debugging.
How do I fix it?
If the emulator is still alive, you can tell adb to connect to it via tcp (which is I believe what it does anyway, only it normally uses an 'emulator' class of name and would now get a ip:port one)
It's been a while since I've had to do that, but I think that if you were using emulator-5554 you would connect to your development machine's loopback one port higher, ie:
adb connect localhost:5555
If it works adb devices will show it an eclipse should see it as a deployment option
The 'in use' problem sounds like a stale lockfile perhaps left behind in a crash
I have another solution. try this
Run configurations > Target > Wipe user data > Run
In my case it happens when I have another process listening on emulator port.
e.g. if I see:
emulator-5554 offline
it means that something is using port 5554
Manually delete these following folders:
C:\Users\%UserName%.android\avd\AVD2.1.avd\cache.img.lock
C:\Users\%UserName%.android\avd\AVD2.1.avd\userdata-qemu.img.lock
this always works for me. :3
On Arch Linux x64, I had this similar problem which led me to this question. Using Eclipse, the emulator-5554 window would freeze, and Eclipse prompted me to start a new one. In the following dialog, emulator-5554 was reported to be offline, with an unknown target. If I started a new instance, it would be emulator-5556. This problem persisted through Eclipse restarts and log-off-on cycles too! Further, killx would close the window, but the process was still running.
So, find the emulator64-arm process id (not emulator-arm!):
ps ax | grep "emulator64-arm"
...and then just kill -9 it:
sudo kill -9 6728
...where 6728 was its PID. This completely disconnects the emulator so Eclipse can try to run it again.
Open android debug monitor window by
typing "monitor" command in cmd,
then select device in the monitor window,
click on down arrow as shown in the figure then just click on reset tab thats all you will get internet connection.
It was some strange
I had that problem, automatically stopped the emulator localhost:5554 after to launch the application.
I didn't know why it happens but intil today I did something different at I could launch as normality.
What I did as different was to change the prespective of Eclipse ADT. I was executing the application from Debug and now I executed from Java Prespective, it worked, I don't know the reason, I had to share it, sound some .. this answer but I resolved doing that without deleting and creating again my android virtual device.