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.
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.
Follow these setup steps before your first session:
- Install Java SE SDK 7 if you don't have it
- Install Git if you don't have it
- Download and install Android Studio
- Create a directory called AndroidStudioProjects. Change to that directory. At the command line, type
git clone https://github.com/ThoughtWorksAustralia/AndroidBootcampProject.git
- 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.
- (Optional) Download and install Genymotion
- Create an account on the Genymotion cloud
- (Mac only) Download and install VirtualBox
- Download and install Genymotion and Genymotion Shell
- 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
- Open the Genymotion app and create a new virtual device
###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
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
###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
Behaviour Driven Development
Testing the Android Way
Serious Unit Testing on Android
Espresso
Robolectric
FEST
Mockito
JUnit
###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
Designing for Multiple Screens
Styles and Themes
Layouts
Grid View
###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)
- Install google play services, Download the appropriate Google Apps for Android zip file for your device from here: https://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.
- Drag the downloaded zip onto your running Genymotion emulator
- Ignore any errors and restart the emulator
- Now using the playstore in your emulator find the App called Camera MX and install it
- 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
EXIF
Intents
Using the Camera in Android
Android Location API (can use to calc distances between two points)
Toasts in Android
###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
Processes and Threads
Retrofit
JSON
https://www.jsonschema2pojo.org
Source code for the Android Bootcamp server
###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
Using image thumbnails as map markers
Clustering markers
Zooming to a collection of markers
Drawing a walking route
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