I have a layered spring boot project(backend) and i want to connect it to an android app client(frontend) to take input and show output, where do i have to start? Is it an HTTP connection or i need to configure the spring boot application? Both backend and frontend are localhost. I'm using java.
            Asked
            
        
        
            Active
            
        
            Viewed 4,851 times
        
    0
            
            
        - 
                    1Start by reading the Andorid documentation: https://developer.android.com/training/volley/simple – Simon Martinelli Jun 06 '20 at 09:52
- 
                    1Does this answer your question? [Best Practices for securing a REST API / web service](https://stackoverflow.com/questions/7551/best-practices-for-securing-a-rest-api-web-service) – smarteist Jun 06 '20 at 11:06
1 Answers
4
            
            
        The usual architecture is following:
- Spring boot applicationis the server - it listens for- requestsfrom clients and answers them with- responses
- Android app,- web app, etc. is the client - it sends- requeststo server and processes the- responses
The structure of the requests and responses is called an API (Application programming interface). You may develop your own API from scratch or better follow a standard - e.g. REST API.
Example (when using REST API):
- User in the android app (client) clicks on Show todos button.
- The android app sends an HTTP request to the server: GET /todos
- The server (spring boot app) responds with HTTP response containing a list of todos in JSON format:
[
    {
        name: "Buy groceries"
        done: false
    },
    {
        name: "Paint house"
        done: true
    },
    ...
]
- The android app parses this response (usually by using a library) and displays it to the user through some user interface elements.
So it's probably best to start with the server part in my opinion, you can easily test it in the browser or using generic HTTP client like Postman. Spring has very good documentation also with beginner guides like this one: https://spring.io/guides/gs/rest-service/ which will get you started quickly.
 
    
    
        Štefan Schindler
        
- 188
- 2
- 10
