Reputation: 11
i am trying to add network using android Wifi Network Request Api every thing is going fine its showing dialog for connect to my given network and click on connect callback onAvailable() method also called but it waits for some time and then after its switch back to last connected network which having internet
Upvotes: 1
Views: 974
Reputation: 41
I know it is very late to answer but maybe someone helps.
You have to bind your network to the connection.
@Override
public void onAvailable(Network network)
{
try
{
super.onAvailable(network);
if (SDK_INT >= VERSION_CODES.M)
{ manager.bindProcessToNetwork(network);
}
else
{ ConnectivityManager.setProcessDefaultNetwork(network);
}
...
Upvotes: 3