Android App Development and Web Server Interactions

后端 未结 4 1622
轻奢々
轻奢々 2021-01-01 07:45

I am just learning about Android Development so excuse me if this is a bit off in nature. I am wanting to make an app that interacts with a Database from my website, in a se

4条回答
  •  孤城傲影
    2021-01-01 08:18

    Based on my experience, the best framework for doing RESTFul things with Android is: Spring Android

    From a client perspective, it provides all the tools needed to access secure RESTFul services. Since it is Spring, it provides nice abstractions over most of the boiler plate http code. As an example, it provides a clean way to perform a GET that returns json, and then serialize that to a POJO.

    As an example:

    RestTemplate restTemplate = new RestTemplate();
    
    // Add Jackson JSON Message Converter to Template
    restTemplate.setMessageConverters(
        new ArrayList>() {
            {              
                add(new MappingJacksonHttpMessageConverter());
            }
        }
    );  
    
    // Simple Conversion - pojo is now populated
    MyPojo pojo = restTemplate.getForObject(url, MyPojo.class);
    

提交回复
热议问题