如何启用Android的后台数据设置? [英] how to enable the background data settings in android?

查看:390
本文介绍了如何启用Android的后台数据设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何启用设置 - >账户和SYNC->背景数据编程 冰淇淋三明治?

How do i enable Settings->Accounts and Sync->Background data programatically in ice cream sandwich ?

谢谢!

推荐答案

您不能这样做编程。只有用户具有privillege。如何以往任何时候都可以检查他是否已启用或不使用。

You cannot do it programatically. Only user has that privillege. How ever you can check whether he has enabled or not using .

ConnectivityManager mgr = (ConnectivityManager)Context.getSystemService(Context.CONNECTIVITY_SERVICE);
boolean bgData = mgr.getBackgroundDataSetting();

和请求通过打开设置来设置用户。使用 ACTION_SYNC_SETTINGS 了解你的意图。你必须确保在发送之前的意图将解决不过,因为有些设备可能无法跨preT的意图。如果他们不能,发送 ACTION_SETTINGS 相反,可能有注意给用户,告诉他们那里的同步设置(如果你的用户预计不会很精通技术)。

And request the user to set by opening the settings. Use ACTION_SYNC_SETTINGS for your intent. You have to make sure before sending it that the intent will resolve though, as some devices may not be able to interpret that intent. If they can't, send ACTION_SETTINGS instead, possibly with a note to the user telling them where the sync settings are (if your users aren't expected to be very tech savvy).

这篇关于如何启用Android的后台数据设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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