Communication between Android app and Python backend

I wrote an app with Android Studio and want to send the data that the user enters to my back-end Python script. This should constantly process the received data and send back the evaluation.

Does anyone have an idea how this could work?

thanks in advance

2 answers

  • answered 2019-10-15 17:36 Dinesh

    1. WebSocket should be the interface of choice. The python script should expose a WebSocket end point . The mobile app can establish a connection to the WebSocket. The socket can act as a bidirectional channel where the app can send and receive data and the python script can do the same.

    2. Firebase : The app could publish the user inputs to a Firebase topic which the python script listens to. The script can process the inputs and publish to the same channel that the app would listen to. More like a P2P chat

  • answered 2019-10-15 18:18 Prashant.J

    From Backend Python: Create 2 web services (GET or POST depending on the requirements). One is to receive the data from Mobile app and other is to send the data to mobile app.

    From Android App: You can use Retrofit or volley library for networking and then consume these web services. Use the web service and send the data(Payload) to the backend and also you can use polling to get the data back to the app.