问题
On android 5, and possibly earlier, if a user goes to his "Data usage" settings, and enables an option called "Restrict background data" for his "Google Services" app, he will no longer receive push notifications while on his mobile network.
Users get told to do that by random websites for security/mobile data/battery reasons, and they forget about it.
We would like to be able to warn user that it is this option is causing them to not reliably receive push notifications, is there any way to programmatically detect it's status?
I have seen this code on google, https://github.com/WhisperSystems/Signal-Android/issues/970#issuecomment-37113943
but
getNetworkActivityInfo doesn't exist (anymore)
Using anything else will always indicate that the network is available and connected, even if said Google services is turned on.
来源:https://stackoverflow.com/questions/36020733/warn-user-if-google-services-restrict-background-data-option-is-activated