Since my first post I have developed an iPhone application (not a watch app) that calculates the users current running pace and average running pace while notifying the user if they are running at their desired pace with either vibrations, sound notifications or both.
Technology Needed: Xcode, Swift, iPhone, Apple ID
To start this app, I used a single view xcode template with two pages in the app. On the first page of the app, the user can enter the distance they would like to run and in what time they would like to run that distance. There is a TextField for the user to input the distance they would like to run (miles) and three TextFields for the user to enter the desired time (Hours)(minutes)(seconds). The pace is then calculated from the information that the user enters and the desired pace is displayed at the bottom of the page. The user can then click the “Lets Run” button which bring the user to the second page (using a segue). The desired pace is then passed on to the next page of the app in which all the calculations are done.
Current pace (minutes per mile), average pace and total distance run (miles) is calculated and displayed. In order to determine the current pace, I used the core location framework in order to access the users location every second and calculate distance covered and speed with each update. When accessing the users speed, it is originally calculated in meters per second which I then converted to miles per hour and then finally minutes per mile (pace). The Start Run button will begin recording distance travelled and the average pace, current pace is constantly calculated. Once the run is started, a counter will display the time remaining. Stop will pause the current run, and Start Run will resume it again. There are two buttons on the right in which the user can choose whether they want sound alerts, vibrate alerts or both.
Originally I had wanted to build this app to work with the apple watch when your phone could be left at home during your run, But i learned pretty quickly that this could not be done. Apple does not allow for any apps to run in the background of the watch which is anytime you are not looking at it or if you are, after a minute of being on. When the app is not able to run in the background, not only could I no notify the user if they were on pace, but could also not keep track of distance.
A week or so before demo-day I had noticed that when I was inside the atlas building the current speed being displayed in my app was not being calculated correctly. When I was not moving the current pace of the user was -26.7 minutes per mile, and would consistently stay like that. I went home to figure out why, only to get back home and the app was working correctly again. Did not think too much of it the first time besides maybe the app just needed to be restarted. Then come demo day, and when I tried to run the app in the building, I noticed the same exact bug, so I figured this was no coincidence and there was actually something wrong with my app… Went home again to fix the bug only to find out once again my app was working correctly. I then began to realize that it was the gps signal of the phone being interfered with inside of ATLAS. Tested this in a few different buildings on campus to find out this is the case in most of the buildings.
Here is a link to my GitHub for this project (it has changed since my first post): https://github.com/Linenfelser/Pace_Multiview