# Agent Config

## Requirements (self-hosted)

| GLPI Version | Minimum PHP | Recommended |
| ------------ | ----------- | ----------- |
| 10.0.x       | 8.1         | 8.2         |
| 11.0.x       | 8.2         | 8.4         |

{% hint style="info" %}
A [GLPI Network BASIC](https://services.glpi-network.com/#offers) subscription (or higher) is required. This plugin is also available for all GLPI Network [Cloud instances](https://glpi-network.cloud).
{% endhint %}

***

## Limitation

### Concerned Version

Since Android 10 (API level 29)

### Limitation

Since Android 10 (API level 29), Google has strengthened restrictions related to accessing sensitive device information, such as IMEI and serial numbers, to protect user privacy. These changes are part of Google’s efforts to limit access to sensitive data and prevent permission abuse by applications.

Here is why we can no longer retrieve this information directly:

#### 1. IMEI and Permission Restrictions

* The IMEI is considered sensitive and private information.
* Since Android 10, only applications with the special permission **`READ_PRIVILEGED_PHONE_STATE`** can access the IMEI. This permission is only available to system applications or those preinstalled by the manufacturer.
* Third-party applications, even with the **`READ_PHONE_STATE`** permission, can no longer access the IMEI.

#### 2. Serial Number

* The serial number is also restricted. Before Android 8 (Oreo), applications could retrieve it via **`Build.SERIAL`**.
* Since Android 8, accessing the serial number requires the **`READ_PHONE_STATE`** permission.
* From Android 10 onward, applications cannot access the serial number unless they are system applications.

A system application is one installed directly in the system partition of an Android device. It is an integral part of the operating system (directly integrated by the manufacturer into the OEM firmware) and enjoys special privileges that standard applications (installed by users) do not have.

Installing an application as a system app is technically possible. However, it involves specific conditions and technical skills:

* **Root Access Required:**\
  The target device must be rooted to allow access to and modification of the system partition, where system applications are installed.
* **Using ADB:**\
  The method requires basic knowledge of using the Android Debug Bridge (ADB) tool to properly copy and configure the APK in the system directory of the device.

We are fully aware of the limitations imposed by Android regarding access to sensitive information (such as the IMEI or serial number) from the inventory agent.

To address these constraints and ensure proper data reporting from the agent, we are currently exploring several alternative approaches, including:

* **Collaboration with Manufacturers (OEMs):**\
  We are considering partnerships with manufacturers to integrate our application directly into the firmware as a system application, which would allow access to the necessary APIs.
* **Obtaining the Required Permissions from Google:**\
  We are analyzing procedures to acquire special permissions (such as **`READ_PRIVILEGED_PHONE_STATE`**) while complying with Google’s privacy and security policies.
* **Alternative Technical Solutions:**\
  We are also exploring technical approaches such as using administrator profiles through Android Enterprise or using non-sensitive identifiers that could replace the IMEI or serial number for our specific requirements.

***

## Install the plugin

* Go to the marketplace. Download and install the **Agent config** plugin.

<div align="left"><figure><img src="/files/8MoaZj5S7SSmLoTx1gSe" alt="images/install_plugin.png"><figcaption></figcaption></figure></div>

## Setting up the plugin

In **`Setup`** > **`General`** > **`GLPI Agent Contiguration`**, select the options you want :

* By default, the URL of the inventory is indicated
* To secure your instance and limit feedback from your mobile devices, you can enter a **login** and **password** for each mobile device to be inventoried
* You can use a **tag entity** (choose **Yes** and indicate your **tag** if needed)
* Choose the **asset type** by default (computers or phones, this information indicates the type of device by default, but can be modified individually from each device)
* Display **QR Code** (on central page)
* Display **Deeplink** (on central page)
* Manage **automatic inventory and frequency** for android

<div align="left"><figure><img src="/files/o9mViEQtw2RZTUI8swFZ" alt="images/setup_plugin.png"><figcaption></figcaption></figure></div>

### Central page

* On **`Home`** > **`GLPI Agent Config`** use Deep link or QR Code to preconfigure the agent :

<div align="left"><figure><img src="/files/pNhLScpupGAxIdAIfAtW" alt="images/asset.png"><figcaption></figcaption></figure></div>

{% hint style="info" %}
When a factory reset is performed on the phone, the serial number automatically generated by the agent changes You can use **Deep Link** / **QR Code** to configure the agent with the serial number previously generated and inventoried in GLPI.
{% endhint %}

## Setup mobile device

* Download the **Agent GLPI** on the Google Store

<div align="left"><figure><img src="/files/xzKrcSKmlIUK4hqL8mH3" alt="images/install_agent.png"><figcaption></figcaption></figure></div>

### With Deep Link

* Go to GLPI with your device web browser
* Click on the DeepLink

<div align="left"><figure><img src="/files/HA8DwqXBt7WFBhC0NOIy" alt="images/deeplink.png" width="374"><figcaption></figcaption></figure></div>

* App will open and pre-fill the fields for adding a server
* Then click on **Add server**

<div align="left"><figure><img src="/files/XYWijJimJtVqOgA6SKCU" alt="images/listserversFilledField2.png" width="374"><figcaption></figcaption></figure></div>

### With QR Code

* Open **GLPI Agent** on your device
* Go to **`Advanced Settings`** > **`Open List Server`** > **`Add servers`**
* Click on **QR Code** button
* Flash QR Code

<div align="left"><figure><img src="/files/as2ArrQHAjVby3u5GQBw" alt="images/listservers.png" width="374"><figcaption></figcaption></figure></div>

* App pre-fill the fields for adding a server
* Then add server.

<div align="left"><figure><img src="/files/XYWijJimJtVqOgA6SKCU" alt="images/listserversFilledField2.png" width="374"><figcaption></figcaption></figure></div>

### Category Global

* In mobile device, **`Menu`** > **`Advanced settings`** > **`Category global`**, select/unselect the informations you want to inventory

<div align="left"><figure><img src="/files/gU7eLi1C1GZdNUs2WvkS" alt="images/global_category.png" width="421"><figcaption></figcaption></figure></div>

***

## Troubleshooting Automatic Inventory (Android)

### 1. Problem&#x20;

**Symptom**: Manual inventory works correctly, but automatic inventory (based on the configured frequency) doesn't always trigger. The device doesn't send information to GLPI after the first manual synchronization.

**Cause**: On recent Android versions (12 to 16), the operating system applies strict power management. By default, Android puts applications in "Optimized" mode, which restricts or stops background processes to save battery. The GLPI Android Inventory agent is then prevented from waking the device to send its data.

### 2. Solution:&#x20;

Configuring Permissions To ensure automatic inventory updates, it may be necessary to remove the software restrictions related to power saving for the GLPI Android Inventory agent.

**Troubleshooting Procedure**:&#x20;

1. On the phone, go to **Settings**.
2. Go to the **Applications** section (or Application Management).
3. Select the **GLPI Android Inventory agent** application.&#x20;
4. Click on the **Battery** (or Battery Usage) tab.&#x20;
5. Change the default setting to "**Unrestricted**".

### 3. Additional Information&#x20;

* **Applicable versions**: Android 12, 13, 14, 15, and 16.&#x20;
* **Deployment Note**: For a large fleet, it is recommended to push this setting via your MDM (Mobile Device Management) solution, if supported, to avoid manual configuration on each device.

***

## Contributing

* Open a ticket for each bug/feature so it can be discussed
* Follow [development guidelines](http://glpi-developer-documentation.readthedocs.io/en/latest/plugins/index.html)
* Refer to [GitFlow](http://git-flow.readthedocs.io/) process for branching
* Work on a new branch on your own fork
* Open a PR that will be reviewed by a developer


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.glpi-project.org/doc-plugins/plugin-glpi-network/agent_config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
