Developing “My Place History” app for iPad and iPhone

My Place History iOS app

“How does your environment impact your personal health?” One way to begin to answer the question is through “geomedicine“. Geomedicine is a new type of medical intelligence that aims to leverage national spatial data infrastructures in order to benefit personal human health and improve the quality of the care medical professionals can deliver.

My Place History is an app that takes a first step at putting this new medical intelligence at your fingertips. The iOS version we built for ESRI was modeled after their Adobe Flash version where you can explore your place history by entering address locations and finding information about toxic chemicals in the surrounding area. The complexity of this application required gathering data and information from multiple sources including ESRI’s GIS, Microsoft Bing’s map API, and Toxic Release Inventory information from the US Environmental Protection Agency (EPA).

We all know that smartphones are very similar to computers but aren’t exactly the same. So when building the My Place History app for iOS, we were able to take advantage of some of the nifty features that the iPhone and iPad have.

Location, Location

One advantage is GPS. We all know what it is and use it frequently on our iOS devices. It’s part of almost every app, from little blue dots on maps to check-in’s on Facebook. What you may not know is that for us developers, it’s not a simple command like “turn on GPS” for you to get these great experiences. We have to consider things like the user experience for devices with disabled GPS, accuracy of the location returned to the device, when the data was last updated, and how to use or convert the data so that it can be used effectively.

With the case of My Place History, we had a workflow which:

  1. first checked if the GPS is enabled
  2. then turned on the GPS until we got accurate data
  3. then turned off the GPS (to save battery life)
  4. sent that data to the Bing API
  5. checked to see if Bing returned results
  6. then converted the results into a list of options for the user select from.

And all you did was hit a button.

Optimizing the App

One of the disadvantages of smartphones is the lack of memory and processing power. In order to accommodate this, we must make efficient use of our images, databases, and background tasks. Though apps may want to present themselves as unique by having fancy images and navigation bars, it’s best to try to keep to as many of the default icons and functionality as possible. Otherwise, you’ll find your app starting to slow down and then eventually crash.

Managing your database models within iOS’s Core Data services is very simple. Just plan out what you need and don’t unnecessarily save data all the time. iOS allows you to save all the information into memory and only commit it to the database when the phone needs memory, the application quits, or it enters the background. To minimize the impact of this app running in the background, we only allow the current tasks such as saving or getting map data to continue when another app comes into the foreground. This allows My Place History to give the user a seamless experience without draining the battery by constantly doing other tasks like updating.

Getting Data out of the App

One of the toughest parts of developing this app was building in the capability to create PDF documents from reports. Creating PDF’s isn’t the most fun thing in the world on iOS because there are a bundle of font issues and every block of text or images has to be placed pixel perfect with the code, including the spacing. This makes the task very tedious and full of headaches when trying to open the PDF for testing if the layout is right.

Dual Development Track

My Place History was developed for the iPhone and iPad platforms at the same time. In order to do  this efficiently, we essentially took an MVC (Model-View-Controller) approach. We set up a number of parent classes that handled all the shared functionality of working with the data and performing actionable tasks, such as GPS and search controls. Then we would subclass those “controllers” and create iPad and iPhone specific “views” which added the UI views and controls to the screen using the proper images and pixel dimensions, and in some cases, a completely separate interface.

What’s Your Place History?

You can download My Place History from the iTunes app store (it’s free!) and start exploring your place history. Let us know what you think. Or check out the video below: