25

In "Settings"->"Data Usage" there is a "Restrict background data" checkbox.

How does it work, exactly? What does "background" mean here? And is this setting enforced by the OS, or is it a hint that the apps are free to disregard if coded improperly?

enter image description here

16

First, that setting is enforced by the OS (so it's not for the app to decide whether to observe that setting). Put in easy words: Android won't let an app access the network unless it's running in foreground (i.e. the user is interacting with it) with the restriction enabled for it.

Explained with a plastic example: Restrict background data on the Google Play Store app (as I did), it won't anymore check for updates in background while you are on mobile data. But it will do so when you're using WiFi. Also, when you call up the app to install something, it will work as long as you keep it in foreground (i.e. not switch to another app while it's still downloading).

  • Thanks. So that comment I linked to is wrong? – sashoalm Oct 26 '13 at 22:38
  • I cannot guarantee that, but I would say so. A setting regarding which that would be true is "background sync" (as even the API doc writes "apps should obey", not "apps must obey). THelper might have mistaken that setting, as the names are quite similar. Thanks for the pointer, I will add a comment there for clarification. – Izzy Oct 26 '13 at 22:42
  • 2
    A quick note on what "foreground" means: usually, in Android, an app is in the foreground if any of its activities are the topmost activity on the screen. The NetworkPolicyManager adds an extra constraint that the screen must be on. "The user is interacting with it" suggests that you must be poking the buttons or something, but actually the activity just needs to be visible on the screen with no other app's activities on top of it. – Dan Hulme Oct 26 '13 at 22:51
  • @sashoalm See the answer I posted on the question you linked for why people might get confused about what the setting does. – Dan Hulme Oct 26 '13 at 22:53
  • Does this also disable services like Android Device Manager? – Stephen Angelico Oct 14 '15 at 14:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.