在ICS是它可以设置和QUOT;限制后台数据"从code(编程)设置? [英] In ICS is it possible to set the "Restrict background data" setting from code (programmatically)?

查看:201
本文介绍了在ICS是它可以设置和QUOT;限制后台数据"从code(编程)设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ICS现在有限制后台数据中的网络设置 - >数据使用设置屏幕。

In ICS there is now the "Restrict background data" setting in the Network -> Data usage settings screens.

有没有一种方法以编程方式设置限制后台数据应用?

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

有没有一种方法,弹出数据使用情况的设置,其中有对我的应用程序的选择吗?

Is there a way to bring up the "Data usage" settings that has the option for my application?

推荐答案

您可以从的数据使用 Android的技术信息页面。

You can start from the Overview of Data Usage Android Tech Info page.

每个网络设备驱动程序会报告其使用statsitics到 xt_qtaguid 模块中的Andr​​oid 3.0的Linux内核。然后,从该框架可以指定附加的规则来限制背景数据业务的应用程序。

Each network device driver will report its usage statsitics to xt_qtaguid module in the android-3.0 Linux kernel. Then, from the framework you can specify additional rules to restrict background data traffic for an application.

尝试提供 counterSet UID PARAMS到 com.android.server.NetworkManagementSocketTagger setKernelCounterSet()方法$ C $。其中, counterSet 值在 android.net.NetworkPolicyManager 定义和 UID 将通过 ContextWrapper.getApplicationInfo()。UID

Try providing counterSet and UID params to com.android.server.NetworkManagementSocketTagger setKernelCounterSet() method. Where counterSet values are defined in android.net.NetworkPolicyManager and UID would be your application id obtained through ContextWrapper.getApplicationInfo().uid.

我希望这可以让你开始。

I hope this gets you started.

这篇关于在ICS是它可以设置和QUOT;限制后台数据"从code(编程)设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆