I am working in Android marshmallow api's which enables user to work on both LTE and WiFi .(i.e) we can force our application to use LTE using hipri network even when the wifi is turned ON by setting network type.
I checked this link: Send request over Mobile data when WIFI is ON.(Android L)
builder.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
builder.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
mNetworkCallback =
new NetworkCallback() {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
Log.d(TAG, "activate(): onAvailable(): " + network);
myConnManager.bindProcessToNetwork(network);
myCallback.networkStateChanged(State.CONNECTED);
}
@Override
public void onLosing(Network network, int maxMsToLive) {
super.onLosing(network, maxMsToLive);
Log.d(TAG, "activate(): onLosing(): ms to live: " + maxMsToLive);
myCallback.networkStateChanged(State.DISCONNECTING);
}
@Override
public void onLost(Network network) {
super.onLost(network);
Log.d(TAG, "activate(): onLost(): " + network);
myConnManager.bindProcessToNetwork(null);
myCallback.networkStateChanged(State.DISCONNECTED);
}
};
Now I am working on getting the IP address of both the connected WiFi network and LTE network. I am not sure how to retrieve the IP address of both connected networks in parallel.
Any help here would be appreciable.