CoffeeMania is a sample Android app to find coffeeshops near your location. It will show the list of coffeeshops, and each list item will show how far the venue is located from you, venue name and its address. Upon clicking any list item, details of the venue will be displayed, such as address, url, phone number, and its location on Google Maps widget.
The app was developed using two-pane layout, so that it will be optimised for using on both
phones and tablets. The MainFragment
will show the ListView
with venues, and upon clicking any of
the items DetailFragment
will be opened with details.
Venue details are retrieved from Foursquare API, to be specific Venues Search API was utilized. From JSON response, following data are taken to be used in the app:
- Venue name
- Venue location latitude;
- Venue location longitude;
- Venue's distance to current location
- Venue address
- Venue category
- Venue total checkins count
- Venue user checkins count
- Venue total tips count
- Venue phone number, if exists
- Venue URL, if exists
Play Services Location API (FusedLocationApi)
was used to get and update the location. If the app
is open, the location will be updated every 5 minutes, and accordingly, the venues list will be
updated as well.
In DetailFragment
, if a venue has a phone number or URL, it will be 'clickable', i.e. clicking
phone number will open Dialer, and clicking URL will open default browser.
Also, MapView
from Play Services Map API
was utilized to show the location of the venue in
DetailFragment
.
On following environment the app was developed:
- OS: OS X Yosemite 10.10.5
- IDE: Android Studio 1.3.2
- Java: 1.6.0_65
- Dependency management: Gradle 1.3.0
Google Volley
to communicate with APIsRobotium
to implement UI testing
The following assumptions were made to develop the app:
- Target devices have Location, Wifi, and/or network enabled to get the location
- No constraints on battery consumption (the app uses High accuracy priority, which could drain the battery faster than usual)
If you want to build the app from source code, first set ANDROID_HOME
environment variable to your
current Android SDK location, for example:
export ANDROID_HOME=/Users/qwerty/Library/Android/sdk
Next, execute the followings:
git clone [email protected]:atabekm/CoffeeMania.git
cd CoffeeMania/
./gradlew build
If your build is successful, you can install newly generated apk file to your device by running
the followings (your adb
file should be located inside platform-tools folder of ANDROID_HOME
):
adb install -r app/build/outputs/apk/app-debug.apk
- Check out project from Version Control -> GitHub -> Login with your GitHub account
- Paste URI from clipboard to
Git Repository URL
, checkParent Directory
andDirectory Name
, click Clone - Just to build, select
Build -> Make Project
from menu - Or to run, select
Run -> Run 'app'
from menu
Basic set of Unit and Instrumentation test have been implemented. In ideal case, both types of the test should be located in separate directories/files, however, due to the time limitation, Unit tests have been added to Instrumentation test suite.
If you want to run the tests of the app from source code, first set ANDROID_HOME
environment
variable to your current Android SDK location, for example (you can skip all the commands till the
last one, if you have already the source code):
export ANDROID_HOME=/Users/qwerty/Library/Android/sdk
Next, execute the followings:
git clone [email protected]:atabekm/CoffeeMania.git
cd CoffeeMania/
./gradlew connectedAndroidTest --info
To run the test from Android Studio, execute following steps (skip first two steps, if your project has been already opened in Android Studio):
- Check out project from Version Control -> GitHub -> Login with your GitHub account
- Paste URI from clipboard to
Git Repository URL
, checkParent Directory
andDirectory Name
, click Clone - On Project window on the top left, expand the directories, and find
UITest
class - Tap with two fingers on
UITest
(right click on PC) - From opened context menu, select
Run 'UITest'