Background mode not working as expceted

We are developing Ionic APP using Angular framework that monitor remote themperature value using API and MQTT socket. When the app move to background, both IoS and Android close socket connection. I’ve tried to use cordova plugin background-mode , but result was awful.

It crashes on many device:

  • Xiamoi Mi10T pro
  • Huaweii Pi30
  • Samsung Galaxy S7

and many other…

How i could resolve it? Is there a way to keep alive connection or how could workaround these problem?