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
Asked
Active
Viewed 885 times
1
-
First, make sharable link and open for all for video. – Chirag Savsani Oct 24 '19 at 05:32
-
thanks , its in drive processing will be available soon – Utsav Thakkar Oct 24 '19 at 05:35
-
https://stackoverflow.com/questions/56831023/android-q-programmatically-connect-to-different-wifi-ap-for-internet – Sanjay Hadiya Oct 24 '19 at 05:39
1 Answers
3
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);
}
...

Dhaval Taunk
- 1,662
- 1
- 9
- 17

Chris
- 31
- 3