GrocerEasy

Context


IAT 359 – Mobile Computing

Android Application

Objective


The objective of the course project was to provide us with an opportunity to explore more topics, functionalities, design patterns, UI design, sensor interaction and hardware features on the Android mobile framework. We designed and implemented an application that used multiple mobile device features in an interesting and useful way.

Overview


GrocerEasy is a utility-based shopping to-do list app where you can create various shopping lists. Users can create multiple lists in which they will be able to add the items they want to purchase when they go to the store and keep track of the items they have checked off. The app features GPS to detect when the user is near an area that the user has set a GPS reminder and give a friendly reminder to the user to buy the items from the list they set the reminder for. GrocerEasy also takes advantage of an accelerometer sensor that, when the user shakes the phone, opens a new activity depending on which screen they are on.

Process


Program(s) Used:

android studio logo

Android Studio

photoshop logo

Adobe Photoshop

The first step for this project was to come up with an idea that fulfilled the project criteria which included the following:

  • At least three activities
  • Implicit intents and explicit intents
  • Storing data in both preferences and SQLite database which would be local to the app
  • Accessing the hardware of the device (for example: battery status, sensors)
  • Camera or GPS functionality

I played around with a few ideas, but in the end settled for a grocery shopping to-do list app. I made sure that the app would meet all the requirements for the project, made my initial sitemap for the application, and a timeline to follow and stay on track to meet the deadline.

Image showing four iterations of logo
Figure 1. First iteration of the sitemap

Originally, the app would have at least three activities such as creating lists, GPS alerts, and adding item favorites to a favorites page. There would be explicit intents to change from one activity screen to another such as going from the main menu page to the “create a list” activity page. Implicit intents would have the app set sound alerts to the user when they are near a store. The app would have data storage local to the app in both preferences and SQLite to store lists, favorites, and reminders. Lastly, it would access the phones hardware such as GPS to track the users’ location, and access the battery status of the phone to turn off GPS when the battery got low.

Sketches of the screen layouts
Figure 2. Initial sketches of the primary screens
Second iteration of sitemap
Figure 3. Second iteration of the sitemap

My primary focus while programming the app was making sure that the functionality was smooth and functional and made sure to look for any issues my app might have. For example, when inputting empty strings in any place where the user should create a list, item, or Google map location for reminders, I made alert dialogs to pop-up warning the user that they must input a name or location. I created a more polished UI for GrocerEasy at the very end as it was not the main goal of this project. Here are some of the design iterations I went through of five primary application activities:

Image showing the first UI iterations of the app UI
Figure 4. First UI iteration of the app
Image showing the second UI iterations of the app UI
Figure 5. Second UI iteration of the app
Image showing the final UI iterations of the app UI
Figure 6. Last UI iteration of the app

These are the following features I implemented by the end of the project:

  • List/Item creation
  • Checkbox functionality
  • SQLite Data Storage
  • Polished UI for all activities
  • GPS Location
  • Google API autocomplete search bar
  • Alert reminders
  • List/Item deleting
  • Screen shake detection using accelerometer to start certain activities
  • Alert dialogs showing the user what the app can do when they use the app for the first time

Challenge


SQLite Databases

There were definitely a lot of challenges when it came to programming this app to work the way I had originally intended. One of the biggest challenges was the SQLite database programming as it was a challenge to know when and where exactly to use certain methods, and even learn about methods that were not covered in class. In addition, deleting lists and items was another challenge as I needed to add in a method startActivityForResult in the Java class MyListAdapter inside the onClick method so when I received the result Intent, the callback provided the same request code so that my app could properly identify the result and determine how to handle it. The onActivityResult read the results using a for loop to look through each one and when a list was deleted or added, it would update the view so that the list was changed instantly and show in real time.

GPS alerts

Another challenge was getting the GPS alerts to work properly as I have the location tracking and alerts in a background service so the user does not need to have the app open for them to get reminders. At first I used regular AlertDialogs to handle the reminders, but that did not work for background services and would crash my app. The way I solved this issue was by making the reminder a system alert window instead. To do this I added the permission in the manifest by adding in: “android.permission. SYSTEM_ALERT_WINDOW”. After that I changed the window manager layout parameter of the alert to TYPE_TOAST in the onLocationChanged method in the MyLocation Java class.

Learning and Insights


As this was the very first Android application I have worked on, I learned a fair bit about how the internal coding and layouts of Android apps work in the real-world. When I first tackled this project I had many expectations and ideas that I wanted to learn how to code and implement in my final app. However, once I started working on it, I quickly realized there were a lot of things I would not be able to learn and have time to do for GrocerEasy. Much of this project involved self-teaching which lead to much time spent figuring out how to do the basic functions that my app needed to have for the project requirements. Had I had more time to work on this project, I might have been able to eventually implement more of the features I had originally planned.