Android - Basic CRUD (REST/RPC client) to remote server
Posted
by
bsreekanth
on Stack Overflow
See other posts from Stack Overflow
or by bsreekanth
Published on 2012-10-28T10:56:52Z
Indexed on
2012/10/28
11:00 UTC
Read the original article
Hit count: 259
android
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.
© Stack Overflow or respective owner