Android - Basic CRUD (REST/RPC client) to remote server
- by bsreekanth
There are lot of discussion about REST client implementation in android, based on the talk at GoogleIO 2010, by Virgil Dobjanschi. My requirement may not necessarily involved, as I have some freedom to choose the configuration.
I only target tablets
configuration changes can be prevented if no other easy way (fix at Landscape mode etc)
I am trying to achieve.
Basic CRUD operation to my server (JSON RPC/ REST). Basically mimic an ajax request from android app (no webview, need native app)
Based on the above mentioned talk, and some reading I see these options.
Implement any of the 3 mentioned in the Google IO talk
Especially, the last pattern may be more suitable as I don't care much of caching. But not sure how "real time" is sync implementation.
Use HTTP request in AsyncTask. Simplest, but need to avoid re-sending request during change in device configuration (orientation change etc). Even if I fix at one orientation, recreation of activity still happens. So need to handle it elegantly.
Use service to handle http request. So far, it say use service for long ruiing request. Not sure whether it is a good approach for simple GET/POST/PUt requests.
Please share your experience on what could be the best way.