This is not a programming related post but something I felt worth sharing for runners/cyclists like me who use the mobile app Strava to track their activity. For the past few months, I have been constantly facing an issue with this app on my Oneplus 3T. Everytime I tried to record an activity, the app used to crash after a few minutes and then after it resumed, it completely messed up the tracking information. This is the error I was getting:
On the map, it used to draw a straight line from the point where it crashed to the point where it resumed. See the straight line in the screenshot below:
It can be frustrating at times especially when you are running in loops. Imagine yourself running around a park with 1 km perimeter and let's say you ran 3 laps from the time the app crashed and it recovered but the straight line distance between the two points is say 100 meters, then instead of showing a distance of 3km, Strava shows that you only ran 100m.
Most of the generic solutions posted online did not work for me. I did eventually find the solution specific to Oneplus phones but had to search through the forums for that. So I felt, sharing a step by step guide on how to solve the problem with screenshots might be helpful. I am sharing what worked for me and should most likely work for other Oneplus users but I can't guarantee that it will.
Solution: short version
I will just mention the steps that need to be performed and then I will elaborate on each step with a screenshot.
- Go to Settings > Location > Mode. Select the mode High accuracy
- Then go to Settings > Apps > Application List. Find the Strava app and click on it.
- Click on Battery. Make sure the Background activity is selected.
- Then click on the Battery optimization. Scroll down to find Strava app in that list. Click on it and select Don't optimize.
- Now go out of settings. Start Strava app to track an activity.
- Click the button on the right side of the home button to bring up recent apps. Find Strava in that list but don't click on it. You should see a small lock icon on the top right corner of Strava app. Make sure that lock icon is of a closed lock. If it shows an open lock, tap on it and it will be closed. This ensures that the OS won't kill the app when you try to close all recent apps
Now start tracking your activities. This should most likely resolve the crashing app issue for OnePlus phones. If you had trouble understanding the instructions above, see below for a more detailed version with screenshots
Solution: detailed version
Step 1: Set the location mode to high accuracy
Go to Settings > Location > Mode and select High accuracy
Step 2: Go to Strava application settings
Go to Settings > Apps > Application List. Find the Strava app and click on it.
Step 3: Select "Background activity" in app's battery settings
Click on Battery
Make sure the Background activity is selected.
Step 4: Disable battery optimization for Strava
In the same view, click on the Battery optimization.
Scroll down to find Strava app in that list. Click on it and select Don't optimize.
Step 5: Lock the Strava app to avoid closing
In Oneplus 3T, there are 3 buttons. Home button (middle), Back button (left) and Recents button (right). The Recents button shows the list of all the apps that are running.
Start Strava app. Then click on the Recents button and scroll to find the Strava in the list of apps shown. On the top right corner of the app, you will see the lock symbol. Make sure it looks like a closed lock like the screenshot below:
If it shows an open lock, tap on the lock icon to lock the app. This setting prevents the app from closing when you tap the option to close all apps.
These steps solved the problem for me, at least for now. I will keep testing the app to see if it crashes again in the same manner and will update this article accordingly. But for now, this solution works perfectly for me. Hope this helps you . Happy running :-)