Does the android platform impose any restrictions to REST that developers should be aware of?
Does the android platform impose any restrictions on RESTful web service calls? Is there anything a developer should be aware of or is it simply a case of calling a given URL and handling the responses?
Do I need to use a framework, something like RESTlet?
I have used REST (yahoo developer APIs) a few times, but haven't done so from android, intersted to know if there is anything I need to be cautious 开发者_如何学JAVAof.
Regards
In my opinion a REST call is nothing special.
You can use the builtin HttpClient from Apache (in my opinion it's more reliable as the java implementation) to fetch the data from the REST endpoint.
But it depends what data you are passing around (XML, JSON, ...). Is security required?
Take the following points into account:
- What data are you passing around? XML, JSON, ...
- How will you extract this data? If you use XML, the following link gives a good comparison of the available parsers in android and their memory consumption.
- Is security required? SSL, Basic Authentication, Sessions (not really REST conform) etc. I recommend Basic Authentication with SSL.
- If you want to access the REST endpoint via SSL, you need a trusted certificate, very few certificates are considered as trusted in android. See my blog post for further information if you don't have a trusted certificate. It's explained how you can add your certifiacte to your own keystore which is considered as trusted by the app.
- See the preemptive Basic authentication example from Apache
- See also Google I/O 2010 - Android REST client applications
Hope this helps you a bit ;)
精彩评论