device-admin

Programmatically deactivate a Device Admininstrator in Android?

谁都会走 提交于 2019-12-06 06:28:57
问题 Is it possible to programmatically deactivate a (third-party) Device Administrator app? I was able to retrieve all the apps with Device Administrator activated using the DevicePolicyManager and getActiveAdmins(): final DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); final List<ComponentName> adminList = dpm.getActiveAdmins(); for ( ComponentName app : adminList ) { Log.d(TAG, "App: ", app.getPackageName()); } However, in order to deactivate

Device Owner on rooted Galaxy S8

二次信任 提交于 2019-12-06 03:47:49
I have been trying to elevate an internal Demo App to Device Owner on my rooted S8 and keep having problems. Ways I have tried: 1) NFC provisioning (as explained here ) When using NFC with Android Bean to set the Device Owner the S8 shows a "Cannot create working profile due to the security guidelines of your device"-error 2) Adb provisioning (from console): When using dpm set-device-owner my/app/namespace/.DeviceAdmin in a windows console I get the following error java.lang.SecurityException: Neither user 2000 nor current process has com.samsung.android.knox.permission.KNOX_PROXY_ADMIN

Android Lollipop becoming device admininistrator doesn't work

旧时模样 提交于 2019-12-05 09:09:54
I'm following this guide on how to have my app request to become a device administrator. This works great on any 4.x android versions with any phone, but doesn't work on Lollipop (I've tried on a Nexus 5 and on a Nexus 7). Logcat shoes the following error: *11-02 07:37:09.649: W/DeviceAdminAdd(10020): Cannot start ADD_DEVICE_ADMIN as a new task* Has anyone else come across this problem with Lollipop? What can be the cause? I've gone over all parts of the guide and made sure my XML, menifest, receiver, etc. are all as they should be (and again, it does work on any other version of OS or phone I

Android ask password on disabling app from device admin?

孤者浪人 提交于 2019-12-05 01:43:08
问题 is there any way to ask password on deactivating a device admin from android device or else to hide or to protect app from un-checking in device administrator. 回答1: What you are asking for is not possible. It would actually be a problem if applications could protect themselves from being uninstalled. Just think about a malware application that gets installed and than you can't get rid of it. 来源: https://stackoverflow.com/questions/15898971/android-ask-password-on-disabling-app-from-device

Work around for Device admin api does not own profile

这一生的挚爱 提交于 2019-12-04 15:18:58
I was working my way through the device admin api, and while invoking the setPermissionGrantState function on the DevicePolicyManager I got Unable to start receiver com.xx.admin.receivers.AdminReceiver: java.lang.SecurityException: Admin ComponentInfo{com.xx/com.xx.admin.receivers.AdminReceiver} does not own the profile. I understand that there are certain functions that can be only run by device/profile owners. Further more that NFC provisioning and dpm command is the way through it. But this is hardly the way I want to proceed when I distribute my app. Is there any way I can automate this

Android: Programmatically remove my app from Device Administrator?

匆匆过客 提交于 2019-12-04 01:42:11
I'm trying to add a button to my app to remove it from Device Administrator and am using the code below but my app just crashes. Code:- On Button Click:- { ComponentName devAdminReceiver = new ComponentName(this, DemoDeviceAdminReceiver.class); DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); dpm.removeActiveAdmin(devAdminReceiver); } In the code above, DemoDeviceAdminReceiver is a class that extends DeviceAdminReceiver. Error log:- 10-28 15:26:09.295: E/AndroidRuntime(26101): FATAL EXCEPTION: main 10-28 15:26:09.295: E/AndroidRuntime(26101):

Android ask password on disabling app from device admin?

那年仲夏 提交于 2019-12-03 16:26:09
is there any way to ask password on deactivating a device admin from android device or else to hide or to protect app from un-checking in device administrator. What you are asking for is not possible. It would actually be a problem if applications could protect themselves from being uninstalled. Just think about a malware application that gets installed and than you can't get rid of it. 来源: https://stackoverflow.com/questions/15898971/android-ask-password-on-disabling-app-from-device-admin

How do you un-provision a device in order to set the Device Owner?

末鹿安然 提交于 2019-12-02 02:02:15
'm trying to set up Device Owner using the sample apps downloadable from developer.android.com https://developer.android.com/samples/NfcProvisioning/index.html https://developer.android.com/samples/DeviceOwner/index.html But when I NFC tap the devices in the logcat for the device I am trying to set the Device Owner for I see this: /? E/ManagedProvisioning﹕ Device already provisioned. However I am doing a factory reset just before attempting the provisioning, so how can I get the device into an unprovisioned state? I've seen different behaviours depending on models. Usually removing all

Device Admin Receiver not working in few versions

本小妞迷上赌 提交于 2019-12-01 20:36:14
I am working on a security app, which protects device from strangers. In my application, I have a feature that should capture the image from front camera if user tries to unlock device with wrong PIN/Pattern/Password. I have a code something like this. public class MyAdminReceiver extends DeviceAdminReceiver { @Override public void onPasswordFailed(Context context, Intent intent, UserHandle user) { Log.d("MyTag", "onPasswordFailed called"); //Code for starting a service for image capture goes here . . . } .... .... } In almost all the versions, I am getting the image captured properly, and the

Require Pass-code to Disable Android Device Administrator

落花浮王杯 提交于 2019-11-30 20:05:00
问题 I was thinking of a security app which will have device administrator privileges. I wanted to see if it was possible to require a pass-code when the user tries to uncheck the app as an administrator under Settings->Security->Device Administrators. This would add a roadblock to not easily allow the user to uninstall the app as they would first need to remove the admin privileges from the app (for which they would need to authenticate with a password) and then they could uninstall. The idea is