I noticed that while streaming audio from a remote server through 3G (mobile) connection and while the WIFI is disconnected or OFF, as soon as WIFI is activated and connected, connection through 3G is dropped.
I want the app keep using 3G even if WIFI is connected too now. I want to do this to keep continuity. (User may opt-in/out to/from this behaviour).
Is there a special flag, lock, etc.. For this purpose?
This isn't possible on devices before Android 5.0 (Lollipop). The OS only keeps one interface up at a time, and applications don't have any control over this choice.
On devices running Android 5.0 or newer, you can use the new multi-networking APIs to pick which interface you want to use for network traffic.
Here's the steps to do this, from the Android 5.0 changelog:
Specifically, if you want to force your traffic over 3G/LTE, even if there's a WiFi signal present, you'd use something like this: