# Grant Permissions for Hexnode Apps using Android Debug Bridge (ADB)

To grant system-level permissions to Hexnode MDM without manual user intervention, use the **Android Debug Bridge (ADB)**. This is primarily required for permissions like **Usage Stats**, **Write Settings**, and **Draw Over Other Apps** on devices where the MDM cannot grant them automatically. The core command structure is:

Prerequisites 
--------------

Before executing ADB commands, prepare the target Android device:

1. **Enable Developer Mode**: Go to **Settings > About phone > Software information**. Tap on **Build number** 7 times.
2. **Enable USB Debugging**: Go to **Settings > Developer options** and toggle on **USB debugging**.
3. **Setup Host Computer**: Install ADB on your computer.
4. **Physical Connection**: Connect the device to the PC via a high-quality USB cable.

Step 1: Install Hexnode and Assign Device Owner 
------------------------------------------------

1. Download the [Hexnode UEM app](https://downloads.hexnode.com/HexnodeMDM.apk) and place it in your computer’s **ADB folder**.
2. Open **Command Prompt** (Windows) or **Terminal** (Mac/Linux) and navigate to the ADB folder.
3. Start the ADB server: Start ADB server
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb start-server
    
       1
    
    
    
      adb start-server
4. Connect the Android device to the computer via USB.
5. Install the app: Install the Hexnode UEM app
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb install HexnodeMDM.apk
    
       1
    
    
    
      adb install HexnodeMDM.apk
6. Set as Device Owner: This command grants Hexnode full control over the device. Make Hexnode UEM the device owner
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell dpm set-device-owner com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver
    
       1
    
    
    
      adb shell dpm set-device-owner com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver
 Note: 
If you only need to set the Hexnode UEM app as the Device Admin, use **adb shell dpm set-active-admin com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver** instead).

 

 
Step 2: Grant Permissions via ADB 
----------------------------------

Once the app is installed, use the following commands to automatically grant necessary permissions.

 Note: 
The commands below use the package name **com.hexnode.hexnodemdm**. If you are using the [Hexnode For Work](https://downloads.hexnode.com/HexnodeForWork.apk) app, replace this with **com.hexnode.mdm.work**.

 

1. **Enable Usage Access** Allows Hexnode to track app usage data.
    
    Enable Usage Access
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell appops set com.hexnode.hexnodemdm GET\_USAGE\_STATS allow
    
       1
    
    
    
      adb shell appops set com.hexnode.hexnodemdm GET\_USAGE\_STATS allow
2. **Enable Draw Over Apps** Required for kiosk mode and remote view features.
    
    Enable Draw Over Apps
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell appops set com.hexnode.hexnodemdm SYSTEM\_ALERT\_WINDOW allow
    
       1
    
    
    
      adb shell appops set com.hexnode.hexnodemdm SYSTEM\_ALERT\_WINDOW allow
3. **Write System Settings** Allows Hexnode to modify system configurations (e.g., brightness, volume).
    
    Write System Settings
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell appops set com.hexnode.hexnodemdm WRITE\_SETTINGS allow
    
       1
    
    
    
      adb shell appops set com.hexnode.hexnodemdm WRITE\_SETTINGS allow
4. **Notification Access**Allows Hexnode to read or dismiss notifications.
    
    **For Android 10 and above:**
    
    Notification Access
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell cmd notification allow\_listener com.hexnode.hexnodemdm/com.hexnode.hexnodemdm.mylistener
    
       1
    
    
    
      adb shell cmd notification allow\_listener com.hexnode.hexnodemdm/com.hexnode.hexnodemdm.mylistener
    
    
    
       
    
     
    
      
    
    **For Android versions below 10:**
    
    Notification Access
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell settings put secure enabled\_notification\_listeners com.hexnode.uem.androidtv/com.hexnode.uem.androidtv.mylistener 
    
       1
    
    2
    
    
    
      adb shell settings put secure enabled\_notification\_listeners 
    
    com.hexnode.uem.androidtv/com.hexnode.uem.androidtv.mylistener
5. **Allow App Installation** Permissions to silently install enterprise apps.
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell appops set com.hexnode.hexnodemdm REQUEST\_INSTALL\_PACKAGES allow
    
       1
    
    
    
      adb shell appops set com.hexnode.hexnodemdm REQUEST\_INSTALL\_PACKAGES allow
6. **Disable Battery Optimization** Ensures the Hexnode app runs in the background without being killed by the OS.
    
    Disable Battery Optimization
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell dumpsys deviceidle whitelist +com.hexnode.hexnodemdm
    
       1
    
    
    
      adb shell dumpsys deviceidle whitelist +com.hexnode.hexnodemdm
7. **Manage All Files (Android 11+)** Grants full access to device storage.
    
    Manage All files from Android 11
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adb shell appops set com.hexnode.hexnodemdm MANAGE\_EXTERNAL\_STORAGE allow
    
       1
    
    
    
      adb shell appops set com.hexnode.hexnodemdm MANAGE\_EXTERNAL\_STORAGE allow

Frequently Asked Questions (FAQs) 
----------------------------------

### Q1: Can I use these commands for the “Hexnode For Work” app? 

Yes. However, you must replace the package identifier in the commands.

- **Standard App**: *com.hexnode.hexnodemdm*
- **Work App**: *com.hexnode.mdm.work*

*Example*: **adb shell appops set com.hexnode.mdm.work WRITE\_SETTINGS allow**

### Q2: Will the user still need to manually grant any permissions? 

Yes. Even after running these commands, the user may still need to manually grant permissions for **App Logs** and activate the **Password Token** inside the app to complete full enrollment.

Troubleshooting Common ADB Errors 
----------------------------------

If you encounter issues while running the commands above, refer to the specific errors below.

### 1. Error: device not found or unauthorized 

**Description**: The computer cannot communicate with the Android device.

**Possible Cause**: USB Debugging is not enabled, the USB cable is faulty, or you haven’t accepted the RSA fingerprint prompt on the device screen.

**Solution**: Check **Developer Options** to ensure USB debugging is ON. Unplug and replug the device, and watch the phone screen to tap “**Allow**” on the “Allow USB debugging?” prompt.