you need to configure the server on your raspberry pi to receive GET or POST calls.
Then from your Android application, use plain standard Java to call this web service and get a suitable response, for example. GPIO status.
for example, an Android application uses a GET request for http://192.168.0.10:8080/GPIO/Toggle/3 , your raspberry Pi server, listening on port 8080, will switch GPIO 3 and respond to Android 00001000 (this means that GPIO 3 is on )
But this is just one possible idea, you can use a library like Kryonet to exchange data on traditional sockets.
source share