当我尝试使用时:
connectivity.getBackgroundDataSetting();
Eclipse 表示它已被弃用。那么,还有其他选择吗?
最佳答案
来自 ConnectivityManager.html#getBackgroundDataSetting() 的文档
This method was deprecated in API level 14. As of ICE_CREAM_SANDWICH, availability of background data depends on several combined factors, and this method will always return true. Instead, when background data is unavailable, getActiveNetworkInfo() will now appear disconnected.
因此在 API 14 之上,只需检查 getActiveNetworkInfo()
不为 null 并将其用作您的 bool 值。
关于android - getBackgroundDataSetting 的替代方法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26804529/