Even allproxy already provides background service, there are still some reasone maybe make it be disconnected:
1. The most reason is battery management of your phone, you should ignore high batter reminder.
2. If you have some system management software, please allow allproxy running in background
3. It will be disconnect if the screen is closed, you may need check the batery settings.
In my huawei phone:
a. settings -> Battery -> click right top corner -> enable [Keep mobile data on during sleep]
4. Disable APP management