In ICS, can I set the "Limit source data" parameter from the code (programmatically)?

ICS now has the option "Limit source data" in the network settings screens → Data.

Is there a way to programmatically set "Limit background data" for my application?

OR

Is there a way to call the "Data Usage" settings, which have an option for my application?

+6
source share
2 answers

You can start by reviewing Data Usage on the Android tech info page.

Each network device driver reports its use of statsitics for the xt_qtaguid module in the android-3.0 Linux kernel. Then from the framework you can specify additional rules to limit the background data traffic for the application.

Try providing the counterSet and UID parameters for the com.android.server.NetworkManagementSocketTagger setKernelCounterSet() method. Where counterSet values counterSet defined in android.net.NetworkPolicyManager and the UID will be your application identifier obtained through ContextWrapper.getApplicationInfo().uid .

Hope this helps you.

+3
source

Regarding the second option, you can study this intention

ACTION_MANAGE_NETWORK_USAGE

"Action Action: Show the settings for managing the use of network data for a specific application."

0
source

Source: https://habr.com/ru/post/910732/


All Articles