/VolleyManager

Volley API manager to handle basic requests such as POST, GET, MULTIPART

Primary LanguageJava

Volley API Manager

This repo shows the basic structure to consume rest api using volley library. This shows handling of all basic requests i.e. POST, GET, MULTIPART POST I have included examples of all types of requests. You can use observer notifications or can use third party library such as event bus to raise notification for calling web services. (Here I have called directly).

ApiModel - This model contains all variables which contains values for the request parameters.

WebServiceManager - This is responsible for handling all the REST api calls.

RequestGenerator - This class is responsible for making request model that specifies what type of request it is, which web service we should call and what parameters we should pass.

Dependencies Used:

  • compile 'com.mcxiaoke.volley:library:1.0.19' : Gradle dependency for volley library
  • compile 'com.google.code.gson:gson:2.4' : GSON used for serialization and deserialization of objects

Below dependencies are used for supporting multipart request as all apache stuff has been deprecated in Android 6.0. See this

compile 'org.apache.httpcomponents:httpcore:4.2.4'
compile 'org.apache.httpcomponents:httpmime:4.3.1'