So, what could possibly be blocking my app's internet connection?
Android has a "restrict background data" option in some versions. You can find it in Settings > Data Usage > ... (overflow) > "Restrict background data".
Some manufacturers go further and block apps from running in the background, such as with SONY's STAMINA mode. Other manufacturers could have similar tweaks.
And is there any way to determine at runtime if there are any data restrictions for my app (or globally on the device)?
For Android's "restrict background data" option, getActiveNetworkInfo()
on ConnectivityManager
is supposed to report null
when you are not allowed to do work in the background.
SONY has decided that adding a couple of lines of code to allow developers to find out if STAMINA Mode is activated is just too much typing, apparently.