M
M
mr_molodoy2017-10-20 10:02:57
C++ / C#
mr_molodoy, 2017-10-20 10:02:57

How to solve background services problems with Xiaomi?

Good day to all.
I have an application written in Xamarin.
The application has a background task that communicates with a remote server through a websocket.
In the very first days of testing, we encountered a problem on Xiaomi devices - as soon as we switch to another application (including without a background service), our task stops working (namely Service, we don’t need a screen).
After we found a pattern - a common device manufacturer, we started looking for a solution on the Internet - it turned out that XUI (their shell, OS add-on) prohibits the work of all applications that are not explicitly allowed to work in the background, in order to save energy.
After setting up the device, the background task does not really crash anymore, but the problem with websockets remains. When the connection is broken - websockets do not want to connect again (the task still works), reconnection occurs in a separate thread that periodically pings if there is a connection, or reconnects if there is no connection.
I note that on all other devices (except Xiaomi) we do not notice such a problem.
Perhaps someone has encountered a similar problem and will share their experience, or someone has guesses based on experience that we unfortunately do not have.
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question