Utsav Thakkar
Utsav Thakkar

Reputation: 11

Wifi Network Request Api connection issue in android 10 (Q)

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

App video Link

Upvotes: 1

Views: 974

Answers (1)

Chris
Chris

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

Related Questions