<< Go Back To MyRuns Document

The MyRuns Labs

The 6 labs serve as checkpoints along the way to build the complete lab. Follow each lab after reading the complete documentation. We provide the APK for each lab and the pointers beflow as well as the detailed spec (above). In what follows, we discuss each lab. We are aware that some UI widgets and their look keep changing as more upgrades are made to the android OS. So we encourage you to only focus on the functionality of the app, rather than the look of the UI, since you may not necessarily achieve it. Don't worry, you won't be penalized for that. 

Lab 1 -- The User Profile

Demo the lab: You can download MyRuns-Android-chk1.apk and run the app to see how it operates. Use that knowledge to fill in the gaps in the above document.

Complete the profile activity. Save profile to the phone and reload when needed.

This is the first in a series of labs that allow you to develop the MyRuns App to capture and display your physical activities using your Android phone. This lab focuses on developing a simple UI for setting up your profile: i.e. name, email, phone number, gender and major. It works as follows: the app presents the user with an activity that allows them to input and save their profile. When the app is opened again, the saved profile information should be reloaded and displayed, allowing the user to review their data and make further changes if needed.

In this lab there is a single activity. The UI design for the activity is specified in Settings Tab section, and the implementation design is specified in Settings Fragment section. The application is defined in the AndroidManifest.xml file. You specify all of these files in XML and Kotlin code. Recall the manifest captures the key information about the application to the Android system, information the system needs before it can run any of the application's code -- for example, the activity name, etc. Typically you will update the manifest for example if you have an application with more than one activity.

Note: since DialogFragment has not been taught at this point, you do not have to implement the selection of the profile image through "select from gallery". When the "Change" button is clicked, you only need to take a picture using the camera.

Please be aware that android:configChanges="keyboardHidden|orientation" is not allowed in MyRuns.

You can use println for logging purpose with Android -- for control flow or looking at programming state such as variables. Alternatively, you can use Log.d(TAG, ..). Setup your on TAG and add Log.d()s to all your methods. If your program crashed, don’t be panic. Look into the system log in the LogCat window, it will print out the function call stack upon crash. If you see logs with red font then that is associated with the exception. Most of the time you will find what causes your crash. We will discuss debugging techniques in more detail next week in class.

Given the nature of the assignments, you might have questions about how much you should or shouldn't do. The answer is you have to do your best to provide us with a working and bug-free version of the demo apps.

For the assignments and grading purposes, the apps you turn in should work under "normal and natural" conditions when used by a user. E.g., if the app crashes between taking a photo and saving it, then it is failing under the expected conditions for use. However, if the app crashes when the user is operating with some exceptional or unexpected conditions, then it is acceptable (i.e., you won't be penalized in this case), e.g., permissions, it is expected that permissions should be granted for normal operation of the app, however, if the user doesn't grant permissions, then it is not a normal operation from the user's side, and the app might crash. In this case, you won't be penalized if the app crashes.

Further, we leave it to your judgment to decide what falls under expected or unexpected use cases. Once in a while, it is OK to clarify with us, but if asking about what to do become too frequent, we might choose not to answer. The purpose of this is to make you think about how real-world app development works, instead of handing you a list of items to check-off.

Ideally, you would want to take into account and fix any crashes because of unexpected use cases, but as I mentioned, you will not be penalized if you don't.

 

Lab 2 -- The User Interface (UI)

Demo the lab: You can download MyRuns-Android-chk2.apk and run the app to see how it operates. Use that knowledge to fill in the gaps in the above document.

In this lab, you need to complete all the user interfaces, including all the activities, main activity's Action Tabs. You should be able to navigate between all of the activities.

You need to continue implementing the profile activity. In Lab 1, you have implemented setting profile picture by taking a photo. As described in Settings Tab section, user should also be able to select a picture from the gallery as their profile image. 

You need to implement all the activities shown in User Interface. To be specific, you need to implement the main activity containing three fragments: start, history and settings. You should be able to switch to different tab. When you rotate the screen, the tab that is open should stay opened. Switching to default tab is not acceptable when the screen rotated.

You don't need to show the map in MapDisplayActivity.

Lab 3 -- The Database

Demo the lab: You can download MyRuns-Android-chk3.apk and run the app to see how it operates. Use that knowledge to fill in the gaps in the above document.

Complete the database design and implementation following the Database Implementation section. You should be able to add an exercise entry manually from the start tab at the main activity, view the entries in the history tab, and delete the entry from DisplayEntryActivity. You need to use a thread for reading/writing data from the database.

You need to show the data in correct format. For example, if the user set their unit preference to Metric (Kilometers), all distance related data should be shown in kilometers. If you save the data in miles, you need to convert it to kilometers before showing it. You need to think of a good way to convert the raw exercise entry data to human readable format. You also need to display some data in the map in Lab 4. Try to come up with a good design to avoid duplicate code.

Lab 4 -- Google Maps

Demo the lab: You can download MyRuns-Android-chk4.apk and run the app to see how it operates. Use that knowledge to fill in the gaps in the above document.

Design and implement the tracking services. Draw the real-time GPS trace on Google Maps using the continuous location updates. Save the traces in the database and visualize the GPS trace history on Google Maps. You should also be able to view the history trace from the history tab.

To be specific, you need to finish implementing the MapDisplayActivity and tracking service.

Lab 5 -- Activity Recognition

Demo the lab: You can download MyRuns-Android-chk5.apk and run the app to see how it operates. Use that knowledge to fill in the gaps in the above document.

Implement activity recognition. You should train an activity classifier by collecting accelerometer data, then apply the classifier in your app.

To be specific, you need to finish implementing activity classifier. This is a three-part problem: collecting training data using the data collector, train the classifier and implement the classifier.

Lab 6 -- Firebase

Demo the lab: You can download MyRuns-Android-chk6.apk and run the app to see how it operates. Use that knowledge to fill in the gaps in the above document.

When using our demo app, be aware that you will not be able to add/delete history items via the Firebase console since you do not have access to my Firebase account. However, here is a demo video, which can give you a brief idea of what you need to develop. Additionally, I provide you with this web-based interface as a proxy to my Firebase database. You can add/delete history items using this tool.

Your backend will be handled by Firebase. On the app side, your app should be able to upload the history list to the server (Firebase), and delete any corresponding entries from the database upon the removal of them on the server. If the user is using history tab, the app should update the history list when an entry is deleted from Firebase. To submit your work, you need to give graders access to your MyRuns6 Firebase project. See details here.