My app needs to connect to an external device (camera) via WiFi (the device is a local network access point). When I connect to the device's WiFi via Android settings, everything works fine, but I've got a requirement that the user should be able to connect with the device right from the app.
I know that there is an option to connect to a specific network via WifiManager.addNetwork but 1) it not always connects me to the network I added 2) this method is deprecated and will stop working when my app targets API 29 (which will happen soon).
I know that the proposed solution for deprecated addNetwork
is suggestion API, but it is available only on Android 10 and above (and my app supports API 21).
Are there any other stable options for connecting to a WiFi network (with no internet access) from the app that are available from API 21 and will be working when I'm targeting API 29?
edit: Ok, now I see that for my use case the Network Request API for peer-to-peer connection is more suitable, but still - it works only for Android 10 +.
After a few months working on this case I now know that:
It seems that Google gave as a new solution that is not really stable (some issues are fixed only in Android 11) and force us to use it. Not really happy about it, but what can you do...