//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;
}
The output indeed includes the device's own name (the text in bold red). Thank you very much!
The output doesn't look like json to me. There must be some easy way to extract the device name, unfortunately all I know is to treat it as a regular string.
Dim jo As JavaObject = StartingIntent
Dim WifiP2pDevice As JavaObject = jo.RunMethod("getParcelableExtra", Array("wifiP2pDevice"))
Dim deviceName As String = WifiP2pDevice.GetField("deviceName")