Android uses callback methods to notify your application of available services, so the first thing to do is set those up. Create a WifiP2pManager.DnsSdTxtRecordListener to listen for incoming records. This record can optionally be broadcast by other devices. When one comes in, copy the device address and any other relevant information you want into a data structure external to the current method, so you can access it later. The following example assumes that the record contains a "buddyname" field, populated with the user's identity.