Seeed-Studio / Wio_Link_Android_App

http://iot.seeed.cc
MIT License
22 stars 8 forks source link

App doesn't connect to WIFI #38

Open Dubzer opened 3 years ago

Dubzer commented 3 years ago

Hi. In the pull request #37 we fixed app crash on the latest Android versions. And after step 3, the device would connect to chosen WIFI network. But it doesn't work with SDK 30, so that's why I had to use target SDK version 28 instead. And it seems like you had to change target SDK to 30 when updating the app in Play Store. So now app cannot connect to selected network automatically. But everything is working if user would connect manually. That's caused by deprecation WifiManager.AddNetwork() in SDK 29:

Compatibility Note: For applications targeting Build.VERSION_CODES.Q or above, this API will always fail and return -1.

And actually, I don't quite understand how to fix it. According to the docs it seems that newer Android SDK doesn't allow to force connection by apps. Instead, it only suggests user to connect with the notification, But in reality, some smart home apps like Yeelight works without any problem on Android 10. So it would be great if somebody could explain it so that I could try to fix this bug.

Dubzer commented 3 years ago

Actually I found that Yeelight is still targeting Android 9, and they're uploaded the latest update just a day before Google added a requirement to use the latest target version.

image