2

A user can enable or disable background data usage by following the following steps:

  1. From the Home screen, tap the app slider, then open "Settings".
  2. Select "Data usage".
  3. Select "Cellular data usage".
  4. Select the app you want to limit background data on.
  5. Toggle "Background data" to "On" or "Off" as desired.

enter image description here

The question is - is there anyway to do it on a mass scale for all apps so that a user do not need to keep repeating the five steps as described above?

Example, a user just need to follow the following steps:

  1. From the Home screen, tap the app slider, then open "Settings".
  2. Select "Data usage".
  3. Select "Background data usage", which will list all the apps. Each row will display the app name, the app version and a "On/Off" switch. If the app was "On" for background data, it will be a "On" for that switch.
  4. Toggle "Background data" to "On" or "Off" as desired thru scrolling on the same page.

(Step 3 should look something like the picture below, which the picture illustrate which WIFI to be "On" or "Off" as a metered Wifi network.)

enter image description here

1

Not sure about GUI interface you want or a third party app that may do this for you, you can use CLI (terminal app or adb shell):

~$ dumpsys netpolicy | grep '^[ ]*UID=.*METERED_BACKGROUND'
  UID=10173 policy=4 (ALLOW_METERED_BACKGROUND)
  UID=10176 policy=1 (REJECT_METERED_BACKGROUND)

File /data/system/netpolicy.xml can also be read directly with root access.

~# awk '$2==10173 || $2==10176 {print $2,$1}' /data/system/packages.list
10173 com.whatsapp
10176 com.simplemobiletools.gallery.pro

Or:

~$ pm list packages -U | sed 's/package://; s/uid://' | grep -E '10173$|10176$'
com.whatsapp 10173
com.simplemobiletools.gallery.pro 10176

It shows that WhatsApp has Unrestricted data usage allowed, while Gallery app is denied Background data usage at all. Rest of the apps have default behavior i.e. they can use background data but not in Data Saver mode.

You can do some further scripting with aapt tool to get e.g. app label / name.

0

fwiw in the ui if you go to the settings screen that lets you control special app access permissions (wifi control, device admins, modify system settings, unrestricted data, etc.) under unrestricted data access the toggle will not be available for any apps you've restricted background data on. I check here to see if I'm missing any apps that I had overlooked toggling individually.

New contributor
jawz101 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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