samedi 26 août 2017

How to Set a WiFi Network as Metered on Huawei or Honor Devices

A growing number of home broadband internet service providers are putting monthly download caps on their service. Some, such as Comcast, will let you pay $50 a month more to be able to ignore their 1TB/month data cap, but others don’t offer this and have a much lower limit with their service. Wireless customers have been dealing with data caps for years and that is why Android automatically treats a mobile data connection as metered. Most Android devices let you set a WiFi network as metered, but for some reason Huawei hides this user-facing feature.

This can be a big deal for some of us within the community as sometimes how much data your phone uses up in the background is hard to track. When Android detects that your phone is on an unmetered WiFi network, it will let apps use up as much data as it wants. OTA updates get automatically downloaded and huge application and game updates get automatically updated as well unless you manually turn that off in the Play Store application. Thankfully though, there’s a way to change this with a simple ADB shell command even if an OEM like Huawei has hidden this setting from you.


How to Set a WiFi Network as Metered

  1. Follow this previous tutorial to get ADB up and running on your device.
  2. In a command prompt or terminal, execute the following command: adb shell
  3. Type the following command into the command prompt or terminal to get a list of all saved WiFi networks: cmd netpolicy list wifi-networks
  4. You’ll be given a list of saved WiFi networks with a true/false boolean value. True = metered & False = non-metered.
  5. So from here, you can enter the following command in a command prompt or terminal to change the setting: cmd netpolicy set metered-network Wireless true
    wifi network metered set
  6. In my example here, the WiFi network I have saved has the SSID “Wireless” and this command changes it from false to true (non-metered to metered).
  7. Now, you can enter the first command we entered earlier to get another printout of your saved WiFi networks: cmd netpolicy list wifi-networks
    wifi network metered updated
  8. And it will show you that you’ve changed it from non-metered to metered (in my example) or from metered to non-metered (if you change it back).

Explanation

As with most of these ADB shell command tutorials that we’ve been showing you lately, Android has this feature built into the platform. And with most cases here, the OEM and/or the carrier has either removed the user-facing setting or it just hasn’t been implemented to begin with. We have this feature in the Pixel from Google and it’s there on the OnePlus 5 as well. Huawei has removed this option though so this can be helpful for those who own a Huawei or Honor device.

The “list wifi-networks” command we first typed in only shows us a list of the saved WiFi networks on our device. Not only does this give you a view of all the networks you have saved, but it also tells you if it is designated as metered or not. My WiFi network has the SSID “Wireless” and it wasn’t set as metered so it returned “Wireless;false” at first.

We then change this with the “set metered-network” command to tell the Android device which wireless network we want to target (via the SSID). We then put a space after that and set a boolean value here of either true or false. My WiFi network was not set as metered at first so I changed this to “true” with that command. Then when I executed the “list wifi-networks” command again, it shows that same WiFi network that it listed before, but now it is a metered network.

You can always come back here in an ADB shell and change this back to false if you want to switch it back to a non-metered network. Just like all settings changes, this will stick after a reboot and OTA update, but will need to be done again if you do a factory reset.



from xda-developers http://ift.tt/2vyl0lf
via IFTTT

Aucun commentaire:

Enregistrer un commentaire