Clio is a data-heavy app. For the iOS app, we use RestKit and CoreData as a persistent storage system. I am looking for an equivalent of RestKit in Android. I have few acceptance criteria for this. It should work well with Clio's REST API, and should be flexible enough to work with the nested attributes and polymorphic associations. And it should support JSON, and have a good community, well used, well tested by apps of similar complexity to Clio.
This post is a summary of my findings today and a conclusion I am about to make. If you have any suggestions or comment, you are more than welcome :)
I am new to Android, so if you have experience with this field, please share your experience with me. I would love to talk. Find me on Twitter at @naoyamakino.
it looks like yet another HTTP client for Android. Nothing much beyond that.
“Spring's RestTemplate is a robust, popular Java-based REST client. The Spring for Android RestTemplate Module provides a version of RestTemplate that works in an Android environment.”“RestTemplate's behavior is customized by providing callback methods and configuring the HttpMessageConverter used to marshal objects into the HTTP request body and to unmarshal any response back into an object.”HTTP Client: used default ClientHttpRequestFactory, when you create a new RestTemplate instance. (the standard J2SE facilities)Google recommends to use the J2SE facilities on Gingerbread (Version 2.3) and newer, while previous versions should use the HttpComponents HttpClient.
RestTemplate supports sending and receiving data encoded with gzip compression.Libraries that are used for JSON mapping: Jackson JSON Processor, Jackson 2.x, and Google Gson.
RestTemplate provides higher level methods that correspond to each of the six main HTTP methods. These methods make it easy to invoke many RESTful services and enforce REST best practices. For example, the method getForObject() will perform a GET, convert the HTTP response into an object type of your choice and return that object. The method postForLocation() will do a POST, converting the given object into a HTTP request and return the response HTTP Location header where the newly created object can be found.
Objects passed to and returned from the methods getForObject(), getForEntity(), postForLocation(), postForObject() and put() are converted to HTTP requests and from HTTP responses by HttpMessageConverter instances.You can also write your own converter and register it via the messageConverters property (customizable)
RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
- executes network requests asynchronously (in a background AndroidService)
RestTemplate from Spring seems to accommodate most of my needs. it handles HTPP requets/response, and do a mapping from JSON to Java objects and vice versa. It looks pretty cool. I haven't tried it yet, but I like it so far from the readings I've done. If you have any suggestions or things I might want to know, please let me know.
Journey with Android development continues..