Skip to content

shihochan/AndroidBootcampProject

 
 

Repository files navigation

AndroidBootcampProject

Objectives

To teach Java programmers the basics of Android development using Agile best practices, by incrementally developing a small game over a period of six weeks.

The App: Treasure Hunt

A single player game. The app supplies a list of photos of 'treasures' in your local area, with hints on how to find them. Your job is to run (or stroll) around the area to find each treasure and take a photo of it. Points are awarded according to how many treasures you can locate and how close you were to the original photo location.

Pre-Bootcamp Preparation

Follow these setup steps before your first session:

  1. Install Java SE SDK 7 if you don't have it
  2. Install Git if you don't have it
  3. Download and install Android Studio
  4. Create a directory called AndroidStudioProjects. Change to that directory. At the command line, type git clone https://github.com/ThoughtWorksAustralia/AndroidBootcampProject.git
  5. If you previously had a version of Android installed on your machine, you may need to use Android's SDK manager to install Build Tools v19.
  6. (Optional) Download and install Genymotion
  7. Create an account on the Genymotion cloud
  8. (Mac only) Download and install VirtualBox
  9. Download and install Genymotion and Genymotion Shell
  10. Install the Genymotion plugin for Android Studio: 1. Android Studio > Preferences > Plugins 1. Browse Repositories 1. Search for Genymotion 1. Choose Download and Install from the context menu
  11. Open the Genymotion app and create a new virtual device

Week 1: Hello Android

###Prerequisites: In the Android Bootcamp directory you set up earlier, do:

git stash
git checkout start-week-1

###Goals:

  • Develop a working "hello world" app and explore its anatomy.
  • Allow the user to enter their name.

###Material:
View the Presentation
Exercise 1: Explore the Lifecycle
Exercise 2: Create a Second Activity Part 1, Part 2
Exercise 3: Capture the Player's Name
Exercise 4: Keep the game state safe, Optional extra

Resources

Android Developers site
The Busy Coder's Guide to Android Development
Saving and retrieving instance state
Parcelable vs Serializable
Genymotion Users Guide
Better performance with the Android emulator
Gradle

Week 2: BDD with Android

###Prerequisites: In the Android Bootcamp directory you set up earlier, do:

git stash
git checkout start-week-2

###Goals:

  • Add a framework for behaviour driven development including a unit test and a functional test
  • Allow the user to view treasures, high scores, and a map page.

###Material:
View the Presentation
Exercise 1: Create a failing instrument test
Exercise 2: Add Espresso to the test Part 1, Part 2
Exercise 3: Some new behaviour
Exercise 4: Add Unit Tests Part 1, Part 2, Part 3
Step by step instructions
Exercise 5: Make the tests pass

Resources

Behaviour Driven Development
Testing the Android Way Serious Unit Testing on Android
Espresso
Robolectric
FEST
Mockito JUnit

Week 3: Layout and Design

###Prerequisites: In the Android Bootcamp directory you set up earlier, do:

git stash
git checkout start-week-3

###Goals:

  • Layout the welcome screen
  • Display a list of treasures

###Material:
View the Presentation
Exercise 1 Part 1,2,3: Prettify the welcome screen
Exercise 1 Part 4,5,6: Further enhancement
Exercise 2 Part 1: Write a test for the Treasure List
Exercise 2 Part 2,3: Create the gridview and adapter

Resources

Designing for Multiple Screens
Styles and Themes
Layouts
Grid View

Week 4: Using the Camera

###Prerequisites:
In the Android Bootcamp directory you set up earlier, do:

git stash
git checkout start-week-4

The default camera app in Genymotion doesn't capture the GPS details for taken photos so we need to install a different camera (otherwise you can use a real device)

  1. Install google play services, Download the appropriate Google Apps for Android zip file for your device from here: http://stackoverflow.com/a/20013322. Make sure the version of Google Apps you use matches the Android version on your emulated device. For example gapps-kk-20140105-signed.zip works with the Google Nexus 5 4.4.2 Genymotion device.
  2. Drag the downloaded zip onto your running Genymotion emulator
  3. Ignore any errors and restart the emulator
  4. Now using the playstore in your emulator find the App called Camera MX and install it
  5. If you cant find it here is the link https://play.google.com/store/apps/details?id=com.magix.camera_mx

###Goals:

  • Find out how to access the Camera app
  • Take a photo of a found Treasure using the phones built in camera app
  • Evaluate its proximity to the listed Treasure

###Material:
View the Presentation
Exercise 1: Register a on item click listener for the treasure list
Exercise 2: Use an Intent to create a photo
Exercise 3: Get the captured photo
Exercise 4: Calculate the distance between the two photos location and show in Toast message

Resources

EXIF
Intents
Using the Camera in Android
Android Location API (can use to calc distances between two points)
Toasts in Android

Week 5: Data and Communication

###Prerequisites:
In the Android Bootcamp directory you set up earlier, do:

git stash
git checkout start-week-5

###Goals:

  • Learn about handling data and communicating with a server
  • Retrieve a real list of Treasures from a server

###Material:
View the Presentation
Exercise 1, Exercise 2 pt1: Write a model for the treasures
Exercise 2 pt2: Writing the client pt 1
Exercise 2 pt3: Writing the client pt 2
Exercise 3 pt1: Using the client
Exercise 3 pt2: Fixing the client

Resources

Processes and Threads
Retrofit
JSON
http://www.jsonschema2pojo.org Source code for the Android Bootcamp server

Week 6: Playing with Maps

###Prerequisites:
In the Android Bootcamp directory you set up earlier, do:

git stash
git checkout start-week-6

Ensure you've installed Google Apps on your emulated device as per the instructions for week 4.

Open the Android SDK manager (Tools > Android > SDK Manager from Android Studio). Check Android Support Repository, Google Play Services and Google Repository from the Extras section at the bottom of the window, and click Install Packages.

###Goals:

  • Explore the Google Maps API
  • Complete the game with a map of actual and found Treasure locations. Generate a score.

###Material: View the Presentation
Excercise 1: Set up for using Play Services
NOTE: This exercise causes all Robolectric tests to fail when run on the command line, due to Robolectric issue 1025!
Exercise 2a: Display the map
Exercise 2b: Nested fragments must be added programmatically!
Exercise 2c: Connect to Google Play Services and zoom to our current location
Exercise 3: Map attempts
Exercise 4a: Add Finish Game button to High Scores fragment, and improve styling.
Exercise 4b: Finish the game, and show Treasures on the map once it has ended.
Exercise 4c: Send player's score to the server, and refresh the high scores

Let's explore

Using image thumbnails as map markers
Clustering markers
Zooming to a collection of markers
Drawing a walking route

Resources

Google Play Services
Installing and Configuring the Google Maps V2 API
Google Maps API
Nested fragments must be added programmatically
Maps in the Genymotion emulator
Sending high score to server - Retrofit with Custom GSON Converter and Callback

About

Treasure Hunt game app for ThoughtWorks' Android Bootcamp

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%