I have some local network services that do not need internet access. Since Lollipop android can automatically switch its active network to mobile data if no internet connectivity is detected on wifi network (exlamation mark icon). I receive ConnectivityManager.CONNECTIVITY_ACTION broadcast that says mobile is taking over.
When that happens it seems I cannot establish TCP connections and multicast UDP packets are ignored even though I have a MulticastLock aquired. I tried to reaquire it, used requestNetworkFeature(), setNetworkPreference() and pretty much every other method ConnectivityManager has to offer but nothing helps.
However turning mobile data off makes android switch back to wifi, I receive the broadcast that its switching and everything goes back to normal. It seems the wifi network must be the active network in order to have full functionality.
Is there a way to force the system to use wifi even if there is not internet?