Last Updated: February 25, 2016
·
668
· sahan

Android networking in 3 steps with RoboZombie 1.3

This is a simple example which showcases networking on Android with RoboZombie.

<br>
Step 1: Create the Model

public class Repo {

    private String id;
    private String name;
    private boolean fork;
    private int forks_count;

    ...
}

<br>
Step 2: Define the Endpoint Interface

@Deserialize(JSON)
@Endpoint("https://api.github.com")
public interface GitHubEndpoint {

    @GET("/users/{id}/repos")
    List<Repo> getRepos(@PathParam("id") String id);
}

<br>
Step 3: Inject and Invoke

@Bite
private GitHubEndpoint gh;   
{
    Zombie.infect(this);
}

...

List<Repo> repos = gh.getRepos("sahan");

<br>

Use it with...

<dependency>
    <groupId>com.lonepulse</groupId>
    <artifactId>robozombie</artifactId>
    <version>1.3.2</version>
</dependency>

or...

dependencies {
    compile 'com.lonepulse:robozombie:1.3.2'
}

or...

robozombie-1.3.2.jar

<br>

Check out the full documentation at sahan.me/RoboZombie

2 Responses
Add your response

Why is it an apklib? I don't seem to find any resources it needs. Can you make it a simple jar?

over 1 year ago ·

@cristian Yes agreed, and I doubt it will ever use any resources. Pushed a jar artifact to the releases repo, should be available now with:

<dependency>
  <groupId>com.lonepulse</groupId>
  <artifactId>robozombie</artifactId>
  <version>1.2.3</version>
  <type>jar</type>
</dependency>
over 1 year ago ·