Android Question Proper way to end a WiFi-Direct Connection

Robert Valentino

Well-Known Member
Licensed User
I cannot seem to end and then start again a WiFi-Direct Connection.

Can someone explain to me what has to be done and what order?

    Private manager                             As WifiManager
    Private server                             As ServerSocket
    Private client                             As Socket
    Private astream                         As AsyncStreams

I've tried these in different orders

I would think there must be a nice clean way to shut down and then restart the connection process again.

It seems after being connected my only way to redo the connection is to turn off WiFi and then turn it back on.

Robert Valentino

Well-Known Member
Licensed User
Well here is my conversion to B4XPages.

Made the whole WiFiDirect as separate page so it is easy to plug in.

Must click on Discover on both devices.
List of devices available will be shown.
Click on one you want to connect to

Still haven't figured how to easy shut everything down, if and when I do will repost.
But have added a button "Try Reset WiFi" that opens the Wifi settings dialog so you can turn off and on again and that seems to fix any problems



PS: Choose landscape mode because that's how devices sit above my keyboard.


    39.5 KB · Views: 64
Upvote 0