[英]getBSSID() returns "02:00:00:00:00:00" and getNetworkId() returns "-1" even with the "ACCESS_COARSE_LOCATION" permission set
I just noticed that WifiManager.WifiInfo.我刚刚注意到 WifiManager.WifiInfo。 getBSSID() now returns 02:00:00:00:00:00 and that WifiManager.WifiInfo. getBSSID()现在返回02:00:00:00:00:00和 WifiManager.WifiInfo。 getNetworkId() returns -1 even with the ACCESS_COARSE_LOCATION permission set.即使设置了ACCESS_COARSE_LOCATION权限, getNetworkId()也会返回-1 。
It's interesting because it used to work great before.这很有趣,因为它以前工作得很好。 It seems that the problem appeared after an Android update.好像是Android更新后出现的问题。
解决的办法是用ACCESS_FINE_LOCATION更换ACCESS_COARSE_LOCATION。
In addition to ACCESS_FINE_LOCATION
, make sure that the Location service is turned on as well.除了ACCESS_FINE_LOCATION
,请确保位置服务也已打开。 I only had WiFi enabled and that is not enough.我只启用了 WiFi,但这还不够。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.