-
Notifications
You must be signed in to change notification settings - Fork 16
Home
Lahiru Sahan Jayasinghe edited this page Jan 13, 2014
·
13 revisions
RoboZombie /rō-bō'zŏm'bē/ noun.
1. Makes Android networking a breeze. 2. Accepts an interface which describes the remote service and gives you an implementation of it. |
|
robozombie-1.3.3.jar |
##Overview
Here's your model.
public class Repo {
private String id;
private String name;
private boolean fork;
private int stargazers_count;
...
}
Define the endpoint.
@Deserialize(JSON)
@Endpoint("https://api.github.com")
public interface GitHubEndpoint {
@GET("/users/{user}/repos")
List<Repo> getRepos(@PathParam("user") String user);
}
Looks for Gson on your build path.
Inject and invoke.
@Bite
private GitHubEndpoint endpoint;
{
Zombie.infect(this);
}
...
List<Repo> repos = endpoint.getRepos("sahan");
Create as many endpoints as you want...
@Endpoint("http://example.com")
public interface ExampleEndpoint {
@Serialize(XML)
@PUT("/content")
void putContent(@Entity Content content);
}
Looks for Simple-XML on your build path.
...and inject 'em all.
@Bite
private GitHubEndpoint gitHubEndpoint;
@Bite
private ExampleEndpoint exampleEndpoint;
{
Zombie.infect(this);
}
RoboZombie requires the **INTERNET** manifest permission for network communication.
<uses-permission android:name="android.permission.INTERNET" />
...and be sure to invoke all synchronous requests from a worker thread.
##Setup > If you opt to use the out-of-the-box JSON (de)serializer add the [Gson](http://code.google.com/p/google-gson) dependency; like wise add the [Simple-XML](http://simple.sourceforge.net) dependency for the XML (de)serializer.
### 1. For Maven based projects.
Add the following dependency to project's pom.xml file.
<dependency>
<groupId>com.lonepulse</groupId>
<artifactId>robozombie</artifactId>
<version>1.3.3</version>
</dependency>
### 2. For Gradle based projects.
Add the following repository and dependency to your project's build.gradle file.
repositories {
mavenCentral()
}
dependencies {
compile 'com.lonepulse:robozombie:1.3.3'
}
### 3. Add the JAR to your build path manually.
Download the RoboZombie-1.3.3.jar and add it to your libs folder.
Note that Gson is required for JSON (de)serialization and Simple-XML is required for XML (de)serialization.
##Wiki
Coding with RoboZombie is a breeze. It follows a simple annotation based coding style and adheres to a minimal intrusion policy. Kickoff with the quickstart and follow the rest of the wiki pages.
##License This library is licensed under Apache License, Version 2.0.