drussell
drussell

Reputation: 11

Xamarin/special wifi permissions for android 10?

I've got an app that connects to a wifi access point, then connects to a local server on port 50,000. Works fine on API < 29. But in 29, I have to use ConnectivityManager instead of WifiManager. Got that working no problem. The problem is connecting to the server afterwards. The device acts like port 50,000 is closed, yet I have other devices right here that are connecting without problem. But if I tell the device to connect to the same server on port 80 (which is also open), boom, instant connection. So I am connected to the access point and the server is accessible, I just can't get it to connect to 50,000. Is there some special permission I need to request to access ports >1024 maybe? I tried adding the internet permission to my manifest, but if I add the capability NetCapability.Internet then the callback gets instantly called with OnUnavailable. Doesn't even try. I've also got capabilities NotRestricted and Trusted in there too. Anyone know what I'm missing here?

Upvotes: 0

Views: 312

Answers (1)

drussell
drussell

Reputation: 11

After the wifi switch succeeds and OnAvailable gets called, you must call ConnectivityManager.BindProcessToNetwork().

Upvotes: 1

Related Questions