WifiWizard2: getConnectedSSID() return unknown ssid in some mobile devices
<!–
Have you read the plugins’ Code of Conduct? By creating an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/tripflex/wifiwizard2/blob/master/CODE_OF_CONDUCT.md
–>
Prerequisites
Check all boxes if you have done the following:
- Checked that your issue isn’t already filed: https://github.com/tripflex/wifiwizard2/issues
- Make sure you fill out the Issue Type below
Issue type
Select all that apply
- Bug
- Enhancement
- Task
- Question
- [] Other
Description
My customer reported that his android shows <unknown ssid> in app but I can’t reproduce it in my devices and emulator whatever android versions. Coincidently, I found some one post a blog that a similar issue for some mobile device - vivo x21iA / vivo x20.
I’ve tested in these two devices and the issue surely could be reproduced. It’s undoubtedly not the bug of plugin. It should be a bug of some firmwares or else, but I can’t tell my customers to contact the mobile manufacturer to solve this problem.
Thus, I have modified the code(WifiWizard2.java) as below(get SSID by another API):
serviceInfo = info.getSSID();
if(serviceInfo != null && serviceInfo.contains("unknown ssid")) {
NetworkInfo wifiInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
String wifiName = wifiInfo.getExtraInfo();
if (wifiName.startsWith("\"")) {
wifiName = wifiName.substring(1, wifiName.length());
}
if (wifiName.endsWith("\"")) {
wifiName = wifiName.substring(0, wifiName.length() - 1);
}
serviceInfo = wifiName;
}
And it works now. Hope this would help someone.
Versions
vivo x21iA / vivo x20 and maybe more Android 8.1 WifiWizard2 3.x
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 15 (7 by maintainers)
Finally i’ve fixed my code ! I’ve uploaded a demo project here: https://github.com/blondie63/CheckWIFI
Believe me, on my Asus i’ve “Location/GPS turned on” and request permissions before call SSID functions… but you wrote:
WifiWizard2.getCurrentSSID returns unknown on Android 8.1 #13
WifiWizard2.getConnectedSSID() NOT working with Android >= 8.1 #67
So which function i can call on Android >= 8.1 to get SSID ?
@gorebill You may wanna try calling WifiWizard2.requestPermission() manually. In your case info.requestPermission(). Experienced the same while using android 8.1+