Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ネットワークに接続していなくても、ワイヤレスが有効になっているかどうかを確認できますか? より正確な GPS 測定値を取得するには、ワイヤレスを有効にする必要があります。しかし、私はどのネットワークにも屈服する必要はありません(Wi-Fiがアクティブでない限り、デバイスは測位にネットワークを使用できないと思われます). データ転送にはモバイルネットワークを使用します。
では、ワイヤレスがアクティブになっているかどうかを確認するにはどうすればよいですか?
public boolean isWifiOn() { WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); return wifi.isWifiEnabled(); }