gpt4 book ai didi

android - 检查 Wifi 时出现 java.lang.Securityexception

转载 作者:太空狗 更新时间:2023-10-29 14:25:57 27 4
gpt4 key购买 nike

private void requestNewCoordinates() {          

final WifiManager wfManager = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
if (manager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
&& wfManager.isWifiEnabled()) {
}
}

<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />

wfManager.isWifiEnabled() - java.lang.Securityexception

告诉我哪里出了问题..以及如何解决问题

https://stackoverflow.com/a/9325388/1568164 - 它有效

最佳答案

在您的 list 中授予此权限

<uses-feature android:name="android.hardware.wifi" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

关于android - 检查 Wifi 时出现 java.lang.Securityexception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12620790/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com