Code Monkey home page Code Monkey logo

hpifitness's Introduction

HPIFitness app

Create simple fitness app for Android with the following requirements:

  • Support different users with user credentials (username and password)
  • Get and store locally the distance walked
  • Feedback on achieving milestones (multiples of 1000 feet)
  • Whenever the person is at office, periodic reminder to stand up and walk every 1 hour.
  • Display daily statistics (in text format) on the main-screen.

#Library for Solution
To measure and save user's distance walked, I applied the following libraries:

  • Butter Knife - Bind view to class member fields
  • Realm - Faster and easier-to-use Local database for authentication and persisting user's walk data.
  • Google Play Service - Provide library for getting access to Google Map and user location

Failed Attempt

  • Google Fit-Tried to use Google fit API to get precise user's steps, and distance walked but data from sensors did not change after many testing. Therefore decided to take advantage of user GPS and Google map.

Challenge and Learning

  • Due to Android activity lifecycle, the distance walked can not be record in the main screen. Therefore a service is created in the background to record the distance and time walked. It is very difficult to maintain a service in the background because the Android system could kill it to claim memory and power usage. The best practice is binding the service to the main screen, and running it in the foreground with a notification.
  • The distance walked is not precise because the Android location service provides location at different interval and the errors increase drastically. For this app, I measure the distance walked by adding consecutively the distance between the current and previous location.
  • The best user experience is letting the user to control the reminder, therefore I let the user turn on and off the notification
  • For authentication, the best practice is not to save user information (username and password on the phone) because there is the risk that it will be found.

To-Do

  • Drawing user's path on Google map still has to be done.

Android Version

  • 5.0 Lollipop - 6.0 Marshmallow

Warning

  • Turn on GPS after installation

Screenshot for final app

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Steps Follow to Complete App

  1. Create a repository for the app to record my work process, results from research
  2. Do research about the best way of getting user distance walked. Result from search:
  1. Wireframing based on the requirements and result from research
  1. Sketch a diagram for the architecture of the app
    Alt text
  2. Create an application in Android Studio: create different branch for every major requirement.
  3. First branch: Google map service connection:
  • Create a map activity
  • Connect to google service by registering the app in Google developer console
  1. Second branch: Create a location service
  • Get location using Location API in service
  • Calculate distance and time in Service
  • Connect service to map activity
  1. Third Branch: create authentication
  • Create log in layout
  • Create Sign up layout
  1. Fourth Branch: Create authentication to Realm database
  • Connect Log in to database
  • Connect Sign up to database
  1. Fifth Branch: Create main screen
    • Create logout
  • Display main statistic
  • Create notification for every 1 hour
  1. Sixth Branch: Connect Main screen to walk screen
  • Follow Activity lifecycle for updating main screen
  • Save user walk data in Realm databases
  1. Last Branch: improve UI, and refactoring
  • Change UI colors
  • Check code for refactoring and naming convention
  • Checks requirements

hpifitness's People

Contributors

marceand avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.