Android Question How to use Wifi Direct

DickD

Active Member
Licensed User
I have just completed a big project using Bluetooth. Now I'd like to add the ability to connect via Wifi Direct mostly for the greater distance (I'll get to router Wifi eventually). I have read the tutorial and downloaded the sample program which I am slowly starting to understand but I have a couple questions.

First I need to get the device name of the remote device. When I asked this question previously I was directed to the b4x/android/help library which curiously listed 2 libraries not listed in the Seagrave book, namely WiFiManager and WIFIdevice. I can see how Manager is used from the sample program but I can find no sample of WiFiDevice or explanation of what it does. I think it must return the name of the remote device which is what I need. A simple sample would be appreciated.

Also, I see in the sample program that the line "lblDeviceNameText=discoveredDevices.Name" in Sub Manager_PeersDiscovered has been commented out. Why? Is the name no longer returned by the discovery process?

B4X:
Sub Manager_PeersDiscovered(Success As Boolean, Devices as List)
    If Success Then
    ....
    'lblDevicesNameText = discoveredDevices.Name

Bottom line: how to I get the name of the remote device? Also, is it possible to set/edit/change the WIFI name of the local device?
 

DickD

Active Member
Licensed User
Yes, this works to find the name. Thanks. Also, can I change the WiFi Direct name of the local phone like I can with Bluetooth?
 
Upvote 0
Top