Setup - Starter Code & Configuring Volley

As this lab builds directly on the previous lab, but requires a number of helper classes you can download the starter code for the lab here - CoffeeMate.5.0.

In this lab, you are required to do the following:

  • Refactor CoffeeMate.4.0 replacing all Database calls with the Web Service calls (one of which is done already). This particular lab is concerned with initially using Volley to make our API calls and ultimately intrgrating Google+ Sign-in to allows us to securely login to our sister Web App - CoffeeMateWeb and still offer the same functionality on the App.

I would also like to bring to your attention our Coffee class as it has been refactored for use with the Web Service, we will be using this version of the model in this, and in subsequent Labs.


Once you import the Starter Code, you'll notice a number of errors, so to fix these we need to import/include the Volley 'Module' in the project. To do this you can either

  • clone the project (via git)
git clone https://android.googlesource.com/platform/frameworks/volley

or download my own volley archive here - volley.zip.

Eitherway, you then need to

File -> New Module, choose Import Existing Project

and Add the following dependencies to your 'build.gradle

compile project(':volley')
compile 'com.google.code.gson:gson:2.4' // for Googles Gson JSON Parser

Add the necessary imports, clean the Project and the errors should be fixed, and if you run the app, you should get something like the following (depending on what's on the server at the time of making the api request)

I would strongly recommend spending some time familiarising yourself with the source code for this starter project - especially the API Calls and how we utilise a 'Callback Interface'.

The remainder of this lab involves integrating Google+ Sign-in and using Volley to interact with the Web App.

results matching ""

    No results matching ""