WPI Computer Science Department

Computer Science Department
------------------------------------------

Project 3: Recognizing Activities with Android Sensors, (8/100 of course grade)
CS 528 Fall 2018 Semester
Due date: Friday, October 25, by class time

Overview

The aim of this project is to get you familiar with Android Sensors, specifically the activity recognition API. You will also explore GeoFences and Android Maps. You should do the project in your groups of 5 students.

NOTE: You can do this project on your own Computer!! Just download and use the most recent version of Android Studio! Testing in the zoolab is NOT necessary

Project Preparation

Step 1: Review Slides for Lectures 4 - 5

Step 2: Review the following information on Activity Recognition

Google recently deprecated thecActivity Recognition API. Android now uses a NEW Activity Recognition Client. Please use the new AR client instead. Information about the new AR client is at:

https://developers.google.com/android/reference/com/google/android/gms/location/ActivityRecognitionClient

Make sure you fully understand how services and broadcasts work in Android before trying to use the Activity Recognition Client. The recognition code above is used in the BackgroundDetectedActivitiesService class. To be specific, the following is the only code in the class you need for registering for activity detection.


Task task = mActivityRecognitionClient.requestActivityUpdates(
                Constants.DETECTION_INTERVAL_IN_MILLISECONDS,
                mPendingIntent);
 
        task.addOnSuccessListener(new OnSuccessListener() {
            @Override
            public void onSuccess(Void result) {
                Toast.makeText(getApplicationContext(),
                        "Successfully requested activity updates",
                        Toast.LENGTH_SHORT)
                        .show();
            }
        });
 
        task.addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
                Toast.makeText(getApplicationContext(),
                        "Requesting activity updates failed to start",
                        Toast.LENGTH_SHORT)
                        .show();
            }
        });
}

To assist you, I got a student of mine to create a code example using the new Android Activity Recognition Client API and put it up on gitHub. Please feel free to use his code for your work.

https://github.com/adonayz/ActivityRecognitionClient.git

Step 3: Get Activity Recognition Working

Step 4: Get GeoFencing Working

Review the following tutorials on geoFencing and get them working.

Step 5: Implement step counting

Implement the simple step counting algorithm we covered in lecture 5 of the class. Don't use the Android step counter. Write your own!

Project Requirements

You are to develop an app that continously recognizes 3 of the user's activities (walking, running, and still). Whenever an activity is recognized, an appropriate picture is displayed and text describing the activity is displayed as well. Display the following images corresponding to the activities:

[ Running ]
[ Still ]
[ Walking ]

Whenever a user switches to a new activity, a toast pops up displaying how long the last activity lasted. For instance, if the user was walking and became still, a toast may pop up announcing "You have just walked for 1 min, 36 seconds".

Set up 2 GeoFences at the following locations:

Your app keeps a running total of how many times the user entered each of these geofences and displays them. The user must take 6 steps in each geofence before it increments the counter. If the user does not take 6 steps inside the geofence, the counter is not incremented. Once the user has completed 6 steps inside the geoFence, a toast may pops up announcing "You have taken 6 steps inside the Gordon Library Geofence, incrementing counter". Display a similar message for the Fuller labs geoFence.

Display a map of your current location at the top of the screen. The final app screen should look like the screen below.





Submitting Your Work

Capture a video of your running program. Make sure to double-check that everything works before submitting. Create a zip file containing your code, your APK and MP4 Video (Captured session) files. Submit your zip file using [ Instruct Assist ] . Do not email me your program or submit it via dropbox.

Before submitting MAKE SURE YOUR PROJECT'S APK FILE RUNS ON YOUR ANDROID PHONE Name your zip file according to the convention LastName1_LastName2_LastName3_LastName4_LastName5_hw3.zip, listing all team members' last names. Your submitted zip file for submission should contain the following folders/files:

\team.txt
\src\
\demo.mp4
\hw3.apk

The contents of team.txt should list team members as follows:

Username, Last Name, First Name
emmanuel, Agu, Emmanuel
msmith, Smith, Mary

Phone tested on: Google Nexus 5 Smartphone
Computer Tested on: Dell Inspiron, I7 2 GHz CPU, 16GB RAM


[Feedback] [Search Our Web] [Help & Index]

[Return to the WPI Homepage] [Return to CS Homepage]

mailto:emmanuel@cs.wpi.edu