I wish to create a web interface for my android application wherein the user can connect using WiFi and do "stuff" similar to the web interfaces provided by many file sharing services like Xender.
I am using nanohttpd to host the web interface. I wish to call a function when a user presses a button on the web page (for example to turn on the flash light).
When the application is opened it starts the server and listens on a particular port. The web interface basically consists of a button. A user can log into the web interface and press the button to turn on the flash light. For that I need the android code to be called when the user presses the button.
How can I accomplish this? Are there better alternatives?