# Xiaomi Troubleshooting

{% hint style="danger" %}
Sometimes when the users take a photo, the Epicollect5 app restarts.
{% endhint %}

Apparently, [**MIUI**](https://en.miui.com/) (the Xiaomi customised version of Android powering almost all Xiaomi devices) has a very aggressive memory management implementation causing any app in the background to be killed when the system finds that is using too much memory.

The Epicollect5 app goes in the background when taking photos because the stock camera app installed on the users' device will be in the foreground. After taking the photo, if the Epicollect5 app was killed while being in the background, the users will experience an app restart.

**This is a known issue which is unfortunately outside of our control**. The following steps can be taken to mitigate the problem until we are able to implement a definitive fix.

### **MIUI 10:** follow[ **this guide**](https://dontkillmyapp.com/xiaomi) and apply it to Epicollect5.

### **MIUI 11**: follow the steps below.

![Open settings](/files/uMYVoGLT3Z5JtvaFQOG2)

![Tap on Apps](/files/o6QtZEFcEb0F5eMXepHe)

![Tap on Manage Apps](/files/4XTghfZn7S1Ax53VETZm)

![Select the Epicollect5 app](/files/S591tmUBMqFCrxcXa0IA)

![Set Autostart On](/files/6uGUo6irW1pIhjhw67S8)

![Tap on Other Permissions](/files/0lyUVUxIZOxIAwIJAtyL)

![Enable all](/files/FgkV1YivSpbtZuJI7aiV)

![Select Battery Saver](/files/1tj2bOn3WLI3MIgquSlF)

![Whitelist Epicollect5](/files/tMPds0D13WMrKyabZcfb)

### Install Open Camera

If Epicollect5 restarts despite having followed all the steps above, we would suggest installing the camera application called [**Open Camera**](https://play.google.com/store/apps/details?id=net.sourceforge.opencamera\&amp;hl=en_GB) (by Mark Harman) to be used as the default camera app for Epicollect5.

![Download Open Camera](/files/2PBv7l37GLs116fyhbxS)

![Set as default](/files/nQgrJndFMev1eTWE5UF0)

{% hint style="success" %}
After downloading Open Camera from the Play Store, the next time the users will try to take a photo using Epicollect5, the app chooser will appear.

Selecting Open Camera with "Remember my choice" checked will replace the stock camera app with Open Camera each time Epicollect5 is used to take a photo.
{% endhint %}


---

# 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://docs.epicollect.net/mobile-application/xiaomi-troubleshooting.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.
