Android REST Client: best solution?
Asked Answered
M

2

7

I need to create an application that dialogues with a REST server.

I found that answer: Android REST client, Sample? but it's of 2012.

Is there a tutorial that I can follow (and that you suggest) in order to obtain a little working sample project? Thanks in advance.

Maidenhood answered 1/7, 2015 at 23:2 Comment(0)
T
7

All you need is here. https://square.github.io/retrofit/ Its easy to use and you almost dont have to care about json deserialization

Thaxton answered 1/7, 2015 at 23:6 Comment(5)
You can try this one: blog.robinchutaux.com/blog/a-smart-way-to-use-retrofit restAdapter and interface are basics of it so focus on it.Semitrailer
As I said, I'm a newbie in this kind of thing. I'm trying since this morning, but I'm not able to get data. I followed this tutorial: androidhive.info/2014/01/… and now I have a working server and I can do REST call by Chrome Extension, but how to do a call like this: localhost/task_manager/v1/login email, passwordMaidenhood
If you can make requests in chrome extension, then its half work done :P Now you need to create retrofit restadapter, set endpoint to localhost with using method .setEndpoint("localhost") (You may need to pass ip number instead of localhost). Create api interface and write request structure. In you case it will look like public interface ApiService { @POST("/task_manager/v1/login") public ClassForLoginResponse login(@Query("email")); } and set the interface in adapter.Semitrailer
Can u please provide me further details?Maidenhood
Let us continue this discussion in chat.Maidenhood
C
2

Try out a Library called Volley which was demoed in Google I/O 2013

Certification answered 1/7, 2015 at 23:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.