WifiP2pDevice status remains on INVITED after a direct Wifi invitation

I am programming a Wifi Direct game, but have encountered a problem with the WifiP2pDevice state when one user declines the invitation to join the connection.

  • Phone A initiates a connection to Phone B
  • The state of phone B becomes INVITED (as shown on phone A)
  • Phone B declines invitation from Phone A
  • Phone B status is still INVITE (as shown on phone A)

Should the status be set to ACCESSIBLE, as shown on Phone A? I updated the list of available devices, but the status remains unchanged. even if I restart the application, it still shows the status of phone B as an invite?

Is this supposed to happen based on the WifiDirect API? or am I missing something?

Edit: Additional Information

In BroadcastReciever, when the target is WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION, the manager accesses peers using a fragment that implements PeerListListener, which simply prints a list of available devices and information (including status) of these devices. Therefore, when Phone A sends an invitation with manager.connect (), it changes the status to INVITED. But if phone B is rejected, the status remains as INVITED. And these statuses are triggered on notifyDataSetChanged (). This is not so much a question about code, but how wifi direct detects and changes device states. But if necessary, I can provide the code.

+4
source share

Source: https://habr.com/ru/post/1529055/


All Articles