检查WiFi和GPS isConnected或不在Android的?GPS、WiFi、Android、isConnected

2023-09-12 22:01:19 作者:软语

我需要检查无线在手机上或关闭在运行时?

I would need to check the wifi is on or off in the phone at the runtime?

如果没有连接,我想显示对话框,转到直接设置/无线控制由用户来启用它。

if it is not connected, i want to show dialog and goto directly Setting/Wireless Controls to enable it by user.

其WiFi和 GPS手机的居留制。怎么做?其意图唤醒这个?你知道吗?

its for both wifi and Gps staus of the phone. How to do it? which intent to wake for this? Any idea?

推荐答案

您可以使用 WifiManager 类获得了Wi-Fi状态。

You can use the WifiManager class to get the state of Wi-Fi.

请参阅this问题打开Wi-Fi设置。而这个问题的 GPS 的状态。

See this question for opening Wi-Fi settings. And this question for GPS status.