Closed byyoungjin closed 3 years ago
Oh, that's definitely possible! I kind of made this app in 2 hours, so it's not my best code, especially the part where it polls the location data from storage. I'll try to replace that code with something more event based, without polling.
As for the sleep stuff, I'm not able to reproduce it. I have used this app for a day, and it roughly registered most of the coordinates. It registered about 150 coordinates, which translates to a usage time of a rough 12.5 hours ((150 * 5) / 60 = 12.5
).
@byCedric I really thank you for your effort. 👍 But the problem keeps happening and I couldn't find anything from google for several days.. So I came back again.. Would you try
I'm sure you can reproduce it!
I set the time as 1000 ms ( because I need to track a running person ) And I think this work on ios, not terminating process or app on sleep mode ( I tested about 1hour )
but on Android On Android 10 simulator, this stops on sleep mode. For me, it logs about 72 locations and stops. If I get out from sleep mode, It keeps logging.. ( for some reason It goes crazy.. ) The main problem is it stops tracking location on sleep mode..
and for some reason, I think expo SDK40 gives me a permission error like this below https://forums.expo.io/t/sdk40-android-unhandled-promise-rejection-error-not-authorized-to-use-background-location-services/46508/4
This makes me really exhausting. I want to know is it about google policy So I should wait for a while until expo team deals with it? or it's just a problem of me?
First of all, I really thank you for this really nice app. I learned something from this app making my own running fitness app.
Issue
Background info
I'm running into this issue https://github.com/expo/expo/issues/10712
when I run this sample app. It worked well, but not in sleep mode. Like I said above issue, It stops tracking after 3~ 5 min. But this app looks different from mine. when I restarted this simple app from sleep mode, its tracking logs go crazy, and not stop before I press the reset button several times.
At first, I thought it store the tracking locations that have not tracked while the phone was in sleep mode.
but it isn't. it just looked like storing several same locations.
So, I looked into the code and found nothing looks strange but this code below
I think this goes infinite loop. Is there no problem with this..? (onPollStorage update locations, locations update onPollStorage, new onPollStorage function trigger useEffect, and useEffect run onPollStorage) and I wonder is it related to that number 2 issue?
https://github.com/byCedric/office-marathon/blob/2ddfbb571e78b02957b8d2f3a04f473d23c83048/src/services/location/index.ts#L72-L92