The EatSleepRIDE app only records your location in the background *when* you are recording a ride, but sometimes tracking goes wrong and can fail in the background so I thought I’d share some notes with you about what we do, and how you can maximize it. 

How Location works on cellphones

All cellphones use what is basically called A-GPS (the A stands for assisted). It practically means that it will use multiple sources to get your location, all of which have varying degrees of accuracy.

First, let's look at A-GPS or cell tower triangulation used to find your location and give you a location fix. It looks at the timestamps of signals from multiple cell towers and does some basic trig to figure out your location. As your cell phone is usually doing this anyway (it the main job of a cellphone, after all) this is essentially a free operation. It’s also pretty inaccurate and only capable of around 1 - 3 km accuracy.

Next, in terms of accuracy, we have WiFi tracking, which at one point may have been called SkyHook. It works the same as cell towers but uses local WiFi access points to define your location. While abundant in urban centres, WiFi has a drawback, it doesn’t give us speed value! In high-density areas, there are many more WiFi tracking points than cell towers, and they are capable of delivering an accurate location. Out in the boonies, where we like to ride, WiFi tracking points are a lot less common.

Now let's talk about “real” GPS, which is to say, uses satellites and reads the NMEA data from the satellite signals to determine your location. As long as you are outside, real GPS does the most accurate job of defining your location. 

So far, so good, but what does this mean for you, the rider and ESR app user? 

Unfortunately, calculating location is one of the most battery-intensive things you can ask your smartphone to do other than leaving the screen on. As a result, most cellphones try to handle getting a location fix in the background. Because your phone can run multiple operations, location lookups can be shared, and that saves you some power. Your device may also switch back and forth from WiFi to cell tower or A-GPS location if the device thinks it can save you power. 

And that’s what we’re fighting - the phone knows better than we do. 

The rest depends on the device you have.

You have an iPhone.

If you're like me, congratulations, there’s really not much for you to do. This is probably the upside of one company making multiple devices. There’s maybe 10 different devices in the market at a time, and they are all made to the precise exacting standards. And these standards have been *rigorously* tested. 

There are only really two reasons why the ESR app doesn’t work for you on iOS. 

Firstly, it crashed in the background. It happens, we apologize and fix it, and then we move on. 

Second, if you ignored the alerts asking you to “Allow ESR to …” and hit NO. Don't fret, it’s easily fixed. Just go to Settings > ESR and set Location to (at least) WHILE USING. Then, set BACKGROUND APP REFRESH to ON. You *can* leave this last one off if you want, but the minute the screen goes dark, or you switch to another app, we lose you. As with most things in the Apple world, it’s your choice.

You have an Android phone.

Welcome to my personal purgatory. 

At last count, there are maybe 14,000 different devices. Most of them are great, but they are *far* from consistent. Even the same device can be manufactured with different components and behave differently. A large number of Android devices, on the one hand, creates price pressure and cheaper handsets, but it also means a lot of what we do is trying to understand the differences that occur. Especially as there is no way we can test all 14,000 devices.

And because we can’t test them all, if you are seeing problems with location tracking, there are a few things you can check.

Permissions 

Like iOS, the ESR Android app needs your location to be able to track your rides. But there are a bunch of other things to do too, and they depend on the handset and version of Android you have. These might include the following:

Background refresh

Disable battery optimization (more on this below).

Location Glitches

When recording a ride, some of you report that often the app “jumps” from one place to the next. We’ve put in some code to fix this in the next major version of the ESR app tracking engine coming in version 3.24, test show it seems to be working well so far. To get on the Open Beta, drop us a line at feedback@eatsleepride.com or just sign up for the Open Beta on the ESR app Google Play Store page.


For those of you that cannot wait for the fix, here's the explanation; there are two main reasons why it's happening.

  • The first is that the connection switches to a lower power provider (either WiFi or 3G) and unfortunately, it doesn’t always switch back again which is it *supposed* to do. If this happens to you, one thing you can try to get your location fix is to disable your WiFi. Trust me, it works.
  • The second problems is that battery optimization

Battery Optimization

I think it was Android 6 or 7 when the Android world started to identify that battery life was a problem because that’s when the permission model started changing with literally every single release. 

It’s not over yet. 

Let me explain, you are out recording a ride - it’s quite reasonable that you want to see *exactly* where you are. Unfortunately, some Android devices see that as “too much usage” and will either switch location down a little (or a lot) or even kill the app in the background. You see that as either straight lines or crashes. 

Yes, we’re supposed to be able to code around it and there are tools for doing so, but they are not reliable in all cases. Not unless you are whitelisted by the device manufacturer. Even larger companies (such as VLC - https://www.cnet.com/news/vlc-for-android-blacklists-huawei-phones-over-background-app-policy/) struggle. 

Users think that *because* it doesn’t happen on some apps (such as Waze or Google Maps) it shouldn’t happen anywhere. I guess, if you own the platform, it’s OK to break your own rules, right?

It’s one area where there are literally no standards. Nokia, which sells its devices as Android One, which means they are essentially “no cruft”, suffer from this problem too, but it’s getting better. Nokia is ditching one such service and I heard rumors that OnePlus will do the same too.

In the meantime, while we wait for Android to implement location tracking with proper permissions and services, there are some great notes at Don’t Kill My App.

More specifically, check out this article for step by step whitelisting for Samsung and OnePlus devices.

If you’ve had issues with the ESR app crashing in the background or giving you straight lines, please check Don’t Kill My App. We know it’s helped a lot of riders out there and if you do find a fix that works, maybe add it to the comments or let me know at feedback@eatsleepride.com 

For more specific Android troubleshooting check out this article How to whitelist the ESR app to avoid Android from putting EatSleepRIDE to sleep in the background.

Enjoy the ride!