I am trying to create an app that restricts camera on Android for my enteprise.
Until now I used device admin, but as far as I know, it's deprecated since API 28.
As I understand, I should use Device Management API and restrict camera using policies.
What I did is created an enterprise, and enrolled my device with a Work Profile that included camera disabled policy, but the Android stock camera app is still working.
The Android Device Policy app does show that the camera disabled policy is applied.
What am I doing wrong?
Also, I noted that the end user can simply go to the Account settings of the phone and delete the work profile.
Can it be prevented?
Thanks!
In order to disable the camera on the whole device you need to set up the device in fully managed mode. To do so you can use one of the available provisioning methods, like the QR code method. You will need to factory reset the device before provisioning it in fully managed mode.
You can set this policy when using AMAPI: "cameraDisabled": true, to disable camera usage on your managed devices.
Related
in the guide for Android Management API it is said
Fully managed mode
In fully managed mode the entire device is managed and
the device needs to be factory reset before setup.
To set up a device in fully managed mode you need to use a QR code.
For devices running Android 7.0 or above:
Turn on a new or factory-reset device.
Tap the same spot on the welcome screen six times to enter QR code mode.
Connect to a WiFi network.
Scan the QR code.
My question is how to add TV that does not have touch support. Are TVs possible at all?
I am not sure if TVs are supported.
You can get more information at the below link :
https://www.android.com/intl/en_in/enterprise/devices/
You can also try DPC identifier method
If Android Device Policy can't be added via QR code or NFC a user or IT admin can follow these steps to provision a company-owned device:
Follow the setup wizard on a new or factory-reset device.
Enter Wi-Fi login details to connect the device to the internet.
When prompted to sign in, enter afw#setup, which downloads Android Device Policy.
Scan a QR code or manually enter an enrollment token to provision
the device.
No. Android Management API won't work on TV
From my last posted question below,
Not getting any idea about the workflow of managing an android device from another device using an pre installed android in both devices
I am here today with new problem. I used android management api to create enterprise, enrolling a device with device policies(Used the sample provided in here a link. But what I am trying to achieve I am not getting it. I want the app to be able to disable all normal apps and camera when parent app blocks them in childs device from its own device using android management api. But what I am getting is that upon upload of enrollment of the policy using enrollment token I see a separate work profile is being created in android device which is not my requirement in the app.
So if anyone out here can help me out in this one be very thankful.
TL DR:
To fully control a device you must enroll it in DEVICE OWNER mode.
I'll try to stick only to this question and address your other concerns answering the other.
You can enroll a device mainly in two modes WORK PROFILE and DEVICE OWNER, one is thought for enterprises that want to allow a BYOD model, the other for enterprises that provide company owned terminals and who wants exert full control on them.
From the docs: https://developers.google.com/android/management/provision-device
The work profile provisioning methods create a work profile on a device. A work profile is a self-contained space that separates work apps from personal apps (see employee-owned devices for more information). On devices with work profiles:
Android Device Policy is installed within the work profile.
devices.managementMode is set to PROFILE_OWNER.
Most policies and commands apply to the work profile only.
The fully managed and dedicated device provisioning methods provide enterprises with full management control over a device:
Android Device Policy is installed on the device's personal (primary) profile.
devices.managementMode is set to DEVICE_OWNER.
Policies and commands apply to the entire device.
Your idea probably needs DEVICE_OWNER mode but here there is the big problem, to enable them you must enroll a device that is factory reset!
So you need a much specific process to prepare a device before use, you cannot achieve a so strict control on a device just installing an app and control it from outside permissions or not. It's against the logic of a "personal device".
I'm new to android enterprise development world, and I have some misconception of how different pieces in the android enterprise ecosystem relate to one another. Let me explain.
The solution that I'm trying to achieve is being able to lock the device into kiosk mode both remotely, and also based on some business logic do it even when the user is offline. I started investigating EMM and particularly Android Management API to solve the problem. I was able to lock the device remotely into kiosk mode using the API. The steps that I take is following
Factory reset the android device
Reach the screen where user needs to enter their credentials
Instead of real credentials I enter afw#setup
Device enters into work profile mode and android device policy is being installed
I create an enrollment token in the management API (the steps for that are described in the quick start guide
I generate a QR code and scan it using the factory reset device as soon as I'm prompted
The device will be linked to the enterprise, and I'm successfully being able to control it and put the device into kiosk mode by creating special kiosk mode policy and patching the device to comply to that policy using a combination of patch policy (to create a policy) and patch device APIs.
The next step was finding out a way to lock the device into kiosk mode even when user is offline. I assume that it's going to happen by creating an android enterprise custom DPC (device policy controller) application. I assumed that by reading the following documentation, where one of the 3 ways of provisioning "single purpose" devices is creating a custom DPC application. Here's another quote from different url
As an EMM, you develop a DPC app that can be used by your customers in conjunction with your EMM console and server. Your customer deploys the DPC to the user devices that they manage. The DPC acts as the bridge between your EMM console (and server) and the device. An admin uses the EMM console to perform a range of tasks, including configuring device settings and apps.
And here's where all of my confusions arise.
First question that naturally arises - was the author of the previous quote referring to EMM management API when talking about EMM console and server?
Further, there are more questions that I couldn't find an answer to
In the guide for creating a custom DPC there are no mentions about what role EMM API will play in custom DPC, and consequently there's no place I could find that describes how exactly the custom DPC is a bridge between the EMM console (presumably EMM API) and the device?
Then, let's assume I've developed a custom DPC application and uploaded it to google play alpha channel. The documentation states that during the setup process instead of entering afw#setup I should enter afw#DPC_NAME, and I have no idea how to generate that name? Is it the bundle ID of the DPC app? Or perhaps it's being set somewhere in google settings? For instance, google has developed the TestDPC application to test enterprise solutions, and I was able to go through the steps I described above and enter afw#testdpc and successfully scanned the QR code in the git readme file and I saw that TestDPC was installed and device was launched into work profile mode. So, I assume somehow I need to register my own "testdpc" and enter afw#my_dpc instead.
Basically I have different pieces working stand alone and I want to form a broader picture in my mind to understand how to stitch those pieces together.
Thanks for your answers
UPDATE 1:
Today I found a way of turning custom DPC into device owner without going through NFC or other provisioning process. This is particularly useful for development purposes. Follow this link for instructions.This is both huge time saver, and also, in my case, we still are waiting for google's approval, but finally we can start testing some stuff without the need of custom provisioning process.
There are two distinct ways of managing Android devices:
The new way: the Android Management API. It is the way recommended by Google and it's significantly simpler than the old way, you don't need to call other APIs or to create a custom DPC. If your use case is not addressed by this API you can send feedback to Google so they can add the missing features.
The old way (no longer available for new deployments as of 2019-12-20): using custom DPC. For that you need to:
create a custom DPC,
register your custom DPC with Google by joining the EMM Community (this is how you get the afw#DPC_NAME),
use the Google Play EMM API to install apps.
In the documentation you - the developer using these APIs - are referred as "the EMM". "EMM server" refers to the server that you own and that calls these API, and "EMM console" refers to the UI console that you expose to your IT admins, if any.
https://developer.android.com/work/dpc/build-dpc
Caution: Android Enterprise is no longer accepting new registrations
for custom device policy controllers (DPCs). Learn more.
Hi #Fred,
I found this above information from the mentioned path.
I have some questions regarding the above conversation.
If we use Android management API to develop EMM, we don't need to implement Custom DPC app?
Whether we can register a account in EMM community with Custom DPC app?
Is it possible to use a custom DPC app with Android management API?
I am using confirm credentials api in my app to authenticate user, using createConfirmDeviceCredentialIntent api.
The api is working fine when I have set up my device lock as pin/pattern/password or fingerprint. But, it's not working in the case of face unlock. I've set face unlock in my device and it's working fine when opening the device. But when I launch the intent using the above mentioned api, it's not recognizing face unlock but all the other things.
Is this a limitation of this api? or I've to do something extra to achieve this?
Can't find this anywhere so posting here.
Unfortunately, this isn't possible because unlocking using your face is part of the Smart Lock set of unlock tools.
Other methods of unlocking that fall under the Smart Lock category include:
On-body detection
Trusted places
Trusted devices
Trusted face (the method in question)
Trusted voice
Because none of these are primitive security methods in Android, it does not make sense to allow these to be accessed using APIs.
If Smart Lock could be used with Keyguard, on-body detection would be in theory be able to grant access to an app, being in a trusted place (but not in the hands of a trusted person) and even trusted voice could be used.
Apple and Face ID can allow this because Face ID is a primitive security method for the iPhone X, as the data used to unlock the device is kept in the Secure Enclave, in the same way that Touch ID data is.
I hope this gives you enough reason as to why this isn't possible, and why it makes sense that this isn't possible.
Sources:
Keyguard (stating unlock methods allowed to be used), Smart Lock, Face ID
BiometricPrompt is introduced in API 28. It will support fingerprint, Iris and face authentication.
Here's an example of how a developer might use it in their app
java.lang.Object
↳ android.hardware.biometrics.BiometricPrompt
Using the BiometricPrompt builder we can:
setTitle() — Set the title to display (Required)
setSubtitle() — Set the subtitle to display (Optional)
setDescription() — Set the description to display(Optional)
setNegativeButton() — Set the text for the negative button(Required).
You must also provide an Executor instance and a click listener for the negative button.
Note: You can’t customise the icon or error message that are used within the dialog.
implementation 'androidx.biometric:biometric:1.0.0-beta01'
Latest Release
GitHub source code available here NativeBiometricScanner developed in Kotlin
We have android app as an Enterprise App which disables the camera of the Device. This functionality breaks when user switch to Guest user or similar functionality. Having app as Device Administer is not enough, We have found one solution to it i.e making app Device owner with nfc-Provisioning and similar approach but this requires the device to be in factory reset mode. So is there any other approach than this which will help us to disable camera across all profiles without factory resetting of the app. I believe this is not an idle approach as per users point of view.
Here is the guide for android Mobile as Administrator here you can disable the camera programmatic ally. You can refer to this link
https://developer.android.com/guide/topics/admin/device-admin.html
You can't and, while it restrains developers, it is actually a good thing for user's security.
Among other things, a Device Admin app cannot
prevent the user from revoking the Device Admin rights,
enforce policies across users,
prevent the creation of new users.
It is relatively easy to lure Android users into giving Device Admin rights and many malwares have already tried to exploit this vulnerability through clickjacking or other means. So it is a good thing for users that Device Admin gives limited management capabilities and can be revoked.
In comparison Device Owner gives full management capabilities but requires factory reset which ensures there is a clear intent from the user.