I have a galaxy tabA tablet on Android 7.0 and I use Retrofit 2 to send http call to my server every 15 minutes to log information about the tablet. My tablet enter in "deep sleep" mode when it is not charging for more than 5 minutes with screen off.
During this deep sleep mode, none of my calls can reach my server and I receive a "connection timeout error".
Does someone has a better understanding of "deep sleep" mode and explain here what is the best way to achieve my behavior (send logs every 15 minutes h24/24) ?
Can someone explain if it is a retrofit bug or an Android feature or something else ?
To solve this problem you must use evernote library : https://github.com/evernote/android-job
In fact, "doze mode" block access to network in deep sleep and wake up at periodic time to let network access open.
This library helped me catch those holy periodic window with network to send my server logs.
Just follow the tutorial in readme to configure this feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With