The problem arises from the Marshmallow version, RequestSync () does not start onPerformSync (). So the synchronization does not occur. Provide an offer in this case.
@Sackurise Android 6.0 M implemented Doze and App Standby modes. It was supposed to be a real cool thing to manage energy conservation, but it wasn’t. Many developers have the same problem as you. Their background services / application process is not working properly, and the problem is this new feature in Android M.
Although Google says adding your application to a special whitelist can solve the problem (only when necessary, or your application can be banned from the Google Play Store, please see https://developer.android.com/training/monitoring -device-state / doze-standby.html ), Google Code has a message that relates to the whole problem, and even a Google employee admitted that this whitelist does not help applications that rely on background work (network access, data retrieval sensors ....)
I will leave a link to this post here https://code.google.com/archive/p/android-developer-preview/issues/2225
This only happens in Android M, since I am testing my application on Android Nougat and it works as it is supposed to work (Nougat has Doze and App Standby features, but they have been improved).
I urge you to continue to search for a solution to this problem, and if you have success on this, please share!
source share