How do you connect an android app to a sensor using WiFi direct and retrieve data?

I am supposed to write an android app that collects data from a portable sensor. I have not got the sensor yet since they needed to modify it first but it should boot with WiFi direct and they should implement a command that retrieves the data from the sensor.

I do not have a lot of experience with programming in general so I was wondering how do you write the code to start up WiFi direct and connect it to the sensor? I have looked at some demo apps for WiFiP2P connecting and data transfer but have a hard time understanding which parts I need to just connect with the sensor and would appreciate all the help I can get.

Thank you for taking you time!