QCRI Report

5
Summer Internship 2015 Qatar Computing Research Institute Dhruv Relwani University of California Berkeley Logistics and Project Description: Contributed to the Mobile/Wearable Health Sensing and Interaction Project at the Social Computing department of Qatar Computing Research Institute, as a summer intern (May - July 2015). Collaborated with my team member (Mohammad Yakoob - iOS app developer) and my mentors (Yelena Mejova, Meghna Singh, Ferda Ofli & Ingmar Weber) for 8 weeks (averaging around 30 hours/week) to develop the Android implementation of the “ICamel” app. Our project was to develop an interactive interface for health-related data, like physical/physiological activity and food consumption, on a mobile or wearable technology that can then be integrated into a social media platform. We achieved this objective by creating a virtual pet that initially intends to build an emotional connection with the user through daily interaction prompts and then challenges the user with tasks involving physical exercise. This lifecycle of the pet is integrated into a game flow that’s driven by user's physical activity signals and screen interaction with the pet that contribute to respective point-systems in the game. Goals Achieved: ICamel Game Concept: Conceptualized the Health and Happiness Meters for the virtual pet and scaled them to optimize user interaction. Accounted for the average number of days in a month and strategically decided the incrementFactor and the reductionFactor for user’s points earned during the game. To ensure regular user interaction, created the dependency of the Health and Happiness Meters on DailyActivity of the user and food from the PetStore; This helps in developing an emotional connection with the pet through regular interaction and in improving user’s health with daily challenges that adapt to user’s behavior while motivating him/her to walk more number of steps. Further developed concepts that can be implemented in the future to enhance the game, like Hide & Seek, Daily Question (to make the user aware about his/her diet) and integration with Social Media. Basic Implementation of the app’s Graphical User Interface: Designed 3 basic user interfaces to provide visual feedback about the user’s progress in the game, his/ her next challenges, the points accumulated and the available options in the PetStore. Implemented 3 different Android Activities (NameScreen.java, ICamelActivity.java and PetStoreActivity.java) to develop the game's flow according to its concept. Searched for the best methods to save the app’s data and finally implemented Android’s SharedPreferences during every possible stage of the life-cycles of different activities, to save the user’s progress (even in the worst cases when the device is switched off or the user receives a call). Resolved the issues related to the device’s RAM consumption (because of the auto-resizing of the layout images to match device’s screen resolution), to develop a smooth connection between different activities of the game. Finally, added the additional feature of walking in the PetStore to earn points from challenges instantly. of 1 5

Transcript of QCRI Report

Page 1: QCRI Report

Summer Internship 2015 Qatar Computing Research Institute

Dhruv Relwani University of California Berkeley

Logistics and Project Description: Contributed to the Mobile/Wearable Health Sensing and Interaction Project at the Social Computing department of Qatar Computing Research Institute, as a summer intern (May - July 2015). Collaborated with my team member (Mohammad Yakoob - iOS app developer) and my mentors (Yelena Mejova, Meghna Singh, Ferda Ofli & Ingmar Weber) for 8 weeks (averaging around 30 hours/week) to develop the Android implementation of the “ICamel” app. Our project was to develop an interactive interface for health-related data, like physical/physiological activity and food consumption, on a mobile or wearable technology that can then be integrated into a social media platform. We achieved this objective by creating a virtual pet that initially intends to build an emotional connection with the user through daily interaction prompts and then challenges the user with tasks involving physical exercise. This lifecycle of the pet is integrated into a game flow that’s driven by user's physical activity signals and screen interaction with the pet that contribute to respective point-systems in the game.

Goals Achieved:

ICamel Game Concept: Conceptualized the Health and Happiness Meters for the virtual pet and scaled them to optimize user interaction. Accounted for the average number of days in a month and strategically decided the incrementFactor and the reductionFactor for user’s points earned during the game. To ensure regular user interaction, created the dependency of the Health and Happiness Meters on DailyActivity of the user and food from the PetStore; This helps in developing an emotional connection with the pet through regular interaction and in improving user’s health with daily challenges that adapt to user’s behavior while motivating him/her to walk more number of steps. Further developed concepts that can be implemented in the future to enhance the game, like Hide & Seek, Daily Question (to make the user aware about his/her diet) and integration with Social Media.

Basic Implementation of the app’s Graphical User Interface: Designed 3 basic user interfaces to provide visual feedback about the user’s progress in the game, his/her next challenges, the points accumulated and the available options in the PetStore. Implemented 3 different Android Activities (NameScreen.java, ICamelActivity.java and PetStoreActivity.java) to develop the game's flow according to its concept. Searched for the best methods to save the app’s data and finally implemented Android’s SharedPreferences during every possible stage of the life-cycles of different activities, to save the user’s progress (even in the worst cases when the device is switched off or the user receives a call). Resolved the issues related to the device’s RAM consumption (because of the auto-resizing of the layout images to match device’s screen resolution), to develop a smooth connection between different activities of the game. Finally, added the additional feature of walking in the PetStore to earn points from challenges instantly.

� of �1 5

Page 2: QCRI Report

Implementation of the app’s back-end (Game’s logic and data collection):

Developed the intricate implementation of the idea flow by creating Game.java to account for all the possible cases (including the corner cases of the Health and Happiness Meters). Provided the app's adaptability to all Android phones based on the device’s hardware (the sensors available) and used the best possible hardware data for the pedometer (StepCounter for phones after Android Kitkat 4.4 and Accelerometer for phones without a step counter). Manually calculated the steps using the accelerometer data using a complex algorithm (by Levente Bagi) and integrated that in the game flow. Strategically utilized the different stages in the life-cycles of the Android activities to determine the days passed during the game, to check the available device sensors and to unregister the sensors (to reduce battery consumption and enhance the app’s efficiency).

User Interface Description:

The NameScreen activity of the app prompts the user to name his/her virtual pet when the app is first opened on an Android device. Consequentially, the ICamel Activity of the app displays the user’s progress in the game through the Health & Happiness meters, step count, counter for the number of challenges completed and points earned. At the center of the screen is the pet camel with which the user can interact by tapping on it to make it feel happy. This image of the pet also revises according to the pet’s satisfaction levels and well-being. In addition to the textual feedback this activity provides to the user about the number of steps required for his/her next challenge, the food & challenges flags signify the user’s contribution to the Health Meter for that particular day. Finally, the PetStore Activity allows the user to utilize the points earned to enhance the pet’s appearance or buy food, toys or accessories for the pet to make it happy.

� of �2 5

Page 3: QCRI Report

Challenges Encountered:

Learning Android Studio and developing sample app

Learned about the foundational tools and processes for developing sample Android applications and minor debugging tips like rendering Layouts in Android Studio 1.2 by manually building the project and syncing Gradle files. Read through multiple descriptions in the API guides on developer.android.com and consequentially learned to develop motion-sensing apps on Android Studio through the Udacity course, “Developing Android Apps”. Acquired knowledge about the App components like Activities, Services, Broadcasts and Content Providers. Created my first sample app, with a user interface that displayed “Hello World”, after learning about the Activity Life Cycles and the process for unlocking developer mode on Android phones. Finally, reviewed the API descriptions for using different sensors like Accelerometer and Step Counter on Android phones.

Step Counter for all Android phones Built a sample app that displayed the speed based on Accelerometer data (beyond some minimum threshold) with which the phone moved and then learned to query step counter data on phones that used Android Kitkat or newer OS and were released after Nexus 5. Searched for algorithms to convert Accelerometer data into step counts, for the phones that don't include a built-in step counter, by reading through the source code for many pedometer apps, the Android Sensing Kit and some suggestions on StackOverflow. Successfully developed and installed a sample app that counts steps for all Android phones with hardwares including at least an Accelerometer. This app provides the best estimation of the user’s step count by querying the step counter for phones that have one or by using an algorithm to convert accelerometer data into steps.

� of �3 5

Page 4: QCRI Report

RAM Consumption issues and separation of UI classes from backend When bulky images are placed in drawable (idpi/mdpi) folder, Android OS tends to resize them according to device’s screen resolution; This caused “Java Out of Memory Error” while loading the ICamel and PetStore Activities. Hence, the images used were subsequently resized manually to meet the requirements and then placed in “res/drawable-nodpi” directory to avoid rescaling. Experienced the “FindViewById method cannot be referenced from static context” exception when the Game.java (backend) file was created to support all the methods that weren’t utilized to access the user interface (encoded in the 3 Android Activity java files). Resolved this issue by saving the instances of Android Activities in static variables (in Game.java) that were utilized to connect the backend to the UI.

Scaling the Health Meter:

The Health Meter is dependent on 2 primary factors- Daily Activity of the user and the food from the Pet Store: The Health Meter has 60 divisions (30 units with 2 divisions each). One unit comprises of 2 divisions of 2 different types - Daily Activity divisions and Pet Food divisions. Daily Activity- If the user completes at least 1 challenge on a particular day, he/she will earn credit to contribute 1 division to the Health Meter. Pet Food- The user can use the points earned from these challenges to purchase pet food and hence contribute 1 division to the Health Meter.

On one particular day- The contribution to the Health Meter cannot exceed 2 divisions (of 2 different types). When The Health Meter is not full:

• Best Case (1 Unit Contribution to the Health Meter = 1 + 1 divisions): • The user walks and completes at least 1 challenge and contributes 1 Daily Activity division to

the Health Meter. • The user also utilizes the Health Points to feed the pet and hence contributes another division

(Pet Food) to the Health Meter. • Since we start the Health Meter at 50% (30 divisions), the user will fill the Health Meter in 15

days by contributing 15 units (2 divisions) daily. • Alternate Case 1: (User accumulates health points but doesn’t exercise):

• The user utilizes the Health Points to feed the pet and hence contributes 1 Pet Food division to the Health Meter.

• The maximum contribution, using Pet Food (earned by Health Points), to the Health Meter cannot exceed 1 division on that day, irrespective of the health points accumulated by the user.

• Hence the total contribution to the Health Meter would only be 1 + 0 division. • However, the Happiness Meter will reflect a negative change.

• Alternate Case 2: (User completes at least one challenge but doesn’t feed the pet): • The user completes one challenge and hence contributes 1 Daily Activity division to the

Health Meter. • The maximum contribution, due to the user’s daily activity, to the Health Meter cannot exceed

1 division on that day, irrespective of the number of challenges completed by the user.

� of �4 5

Page 5: QCRI Report

• The benefit of completing additional challenges would only be reflected in the Health Points earned (which can then be accumulated to buy gifts from the Pet Store).

• Hence the total contribution to the Health Meter would only be 0 + 1 division. • However, the Happiness Meter will reflect a negative change.

• Worst Case (The user neither completes a challenge nor feeds the pet): • The Health Meter would go down by 2 divisions. • The Happiness Meter will reflect a negative change. • Since we start the Health Meter at 50% (30 divisions), it's reasonable to “kill” the pet after 30

days of inactivity. • In the best case (the Health Meter is full: 60 divisions), the user can then remain inactive for

60 days before the pet “dies”.

When The Health Meter is full: • Best Case (User completes Daily Activity and provides Pet Food):

The Health Meter remains full.

• Alternate Case: The Health Meter would go down by 4 divisions.

Future Ideas:

1) Using a heuristic to learn the user’s most visited routes and then integrating them in the Hide n Seek game with the pet.

2) Utilizing the user’s food pictures shared on social media like Instagram to check for nutritional values and health benefits by using Google’s Image Search API.

3) Integrating Facebook for ranking the user against his/her friends based on the points earned in the game.

4) Storing the game data on external servers to query for medical studies about daily physical activity in different lifestyles.

ICamel Source Code: https://[email protected]/healthypet/icamel-android.git

� of �5 5