I am programming a Wifi Direct game, but have run into a problem with the WifiP2pDevice Status when one user declines the invitation to join the connection.
- Phone A initiates connection to Phone B
- Phone B status becomes INVITED (as displayed on Phone A)
- Phone B decline invitation from Phone A
- Phone B status is still INVITED (as displayed on Phone A)
Shouldn't the status be shifted back to AVAILABLE as displayed on Phone A? I have refreshed the list of Available devices, but the status remains unchanged. even if I restart the app, it still shows the status of Phone B as invited?
Is this supposed to happen based on the API of WifiDirect? or am I missing something?
Edit: More Information
In the BroadcastReciever, when the intent is WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION, then the manager requests the peers using a Fragment that implements a PeerListListener, which just prints a list of available devices and information (including status) of those devices. So when Phone A sends an invitation with manager.connect() it changes the status to INVITED. But if Phone B declines, the status remains as INVITED. And those statuses are triggered on a notifyDataSetChanged(). It is not so much a question about code, but how wifi direct determines and changes statuses of the devices. But I can provide code if needed.