I'm wondering how to let my app retrieve the device name under WiFi Direct settings, not the name of the discovered peers.
I found a piece of code (see below) from here. If someone could make it work in B4A, that would be great.
I found a piece of code (see below) from here. If someone could make it work in B4A, that would be great.
B4X:
//After you turn on wifi on your device, it is send a WIFI_P2P_THIS_DEVICE_CHANGED_ACTION broadcast. You can catch this with a broadcast receiver and you can get a WifiP2pDevice object, that is your device.
@Override
public void onReceive(Context context, Intent intent) {
WifiP2pDevice device = intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_DEVICE);
String thisDeviceName = device.deviceName;
}