IceNet : Fast, Simple and Easy Networking for Android

is an Android networking wrapper consisting of a combination of Volley , OkHttp and Gson . This library is very very simple and easy to use. With IceNet you can write code looks like talking to backend engineer..:D

The result of request with is always the Object or the Array of Object. And also, provide Header and Body Request Builder , moreover you can put Object as a body request.

Usage

Gradle

compile 'com.anton46:IceNet:1.0.2'  

Maven

<dependency>  
    <groupId>com.anton46</groupId>
    <artifactId>IceNet</artifactId>
    <version>1.0.2</version>
</dependency>  

Initialization

public class YourApplications extends Application {  
    ...

    @Override
    public void onCreate() {
        super.onCreate();
        initIceNet();
    }

    public void initIceNet() {
        IceNetConfig config = new IceNetConfig.Builder()
                .setBaseUrl("http://someApi.com")
                .setContext(getApplicationContext())
                .build();
        IceNet.init(config);
    }

    ...
}    

GET REQUEST

    IceNet.connect()
                .createRequest()
                .get()
                .pathUrl("/v1/feeds")
                .fromJsonArray()
                .mappingInto(Feeds.class)
                .execute(REQUEST_TAG, callback);

POST REQUEST

IceNet.connect()  
                .createRequest()
                .post(bodyRequest)
                .pathUrl("/v1/feed")
                .fromJsonObject()
                .mappingInto(PostResponse.class)
                .execute(REQUEST_TAG, callback);

BUILD HEADER

Header header = new Header.Builder()  
                                    .add("Authorization", "Token token=" + "token")
                                    .build();

BUILD BODY REQUEST

  Body device = new Body.Builder()
                            .add(DEVICE_TYPE_KEY,"")
                            .add(DEVICE_OS_KEY,"")
                            .add(DEVICE_UUID_KEY,"")
                            .add(DEVICE_PUSH_TOKEN, "")
                            .build();

Simple and easy right? :D

Contributing

If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request.