After turning on Wi-Fi on your device, it will send the broadcast WIFI_P2P_THIS_DEVICE_CHANGED_ACTION. You can catch this with the broadcast receiver, and you can get the WifiP2pDevice object, i.e. your device.
@Override public void onReceive(Context context, Intent intent) { WifiP2pDevice device = intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_DEVICE); String thisDeviceName = device.deviceName; }
Lรกszlรณ magyar
source share