Wire loses server connection when device is in sleep mode
I recently switched to a new phone running Android 10. As I don't have Google Apps installed I am using Wire's internal "maintain connection" option. On my old phone with Android 9 the server connection was stable but on Android 10 Wire disconnects immediately when the phone goes into sleep mode. As soon as I wake it up Wire reconnects and stays connected until the phone goes to sleep mode again.
Steps to reproduce the behavior:
- Install Wire on an Android 10 device
- Enable "maintain connection" option
- Wait until phone goes to sleep mode or put it in sleep mode manually
- No new messages will be received
- Wake up the phone
- The notification popup will briefly show "Connecting...", then "Connected to Wire server" message
- Wire will receive new messages until phone is in sleep mode again
Expected behavior: Server connection should remain active while the phone is in sleep mode
Smartphone:
- Wire version that exhibits the issue: 3.46.890
- Last Wire version that did not exhibit the issue (if applicable):
- Android OS version used to run Wire: 10.0 (works on 9.0)
- Is this a custom firmware or a stock one: custom (crDroid 6.4)
- Mobile phone model/manufacturer: Xiaomi Redmi Note 8T
- Mobile network type (EDGE/LTE/Wi-Fi/Offline): LTE/Wi-Fi
Additional context: Other apps using their own server connections do not have any problems on my phone so I think it is not a general Android issue.
Some more observations after using my new phone for some time.
- I thought the reason might be my phone switching between WiFi and mobile network very often. But according to my router its WiFi connection is stable, even during sleep mode.
- Sometimes Wire stays connected for several hours but it seems to happen randomly.
@mss-hh See below details,
- Whitelist wire app from battery optimizations see https://dontkillmyapp.com/general (for custom ROMs) see https://dontkillmyapp.com/xiaomi see https://dontkillmyapp.com/google
- Alternatively, Set wire app as device administrator (set to allow) (this definitely solve the problem in every android versions)