How to handle the negative response of connection request in Wi-Fi direct in Android devices?

370 views Asked by At

I am using Wi-Fi direct in my application. I am able to establish the connection between two Android devices.

I want to handle the negative response of connection request. When a User1 send connection request to User2 and if User2 denies that request, then how User1 would know that User2 denies his connection request. I have researched about this, but I couldn't able to find anything.

Question:

  1. How to handle the negative response of connection request at senders end?
1

There are 1 answers

4
jack jay On

This method you have to define after implementing WifiP2pManager.ConnectionInfoListener.

@Override
public void onConnectionInfoAvailable(final WifiP2pInfo info) {


   if(info.groupFormed) {
        //groupformed is a boolean which will be true when user2
       // accepts the connection otherwise false.
    }
}