-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coordinate callback getting called multiple times for same coordinate on iOS #19
Comments
After a short look into my own codebase it turns out that I am actually getting the timestamp using the |
So I researched the topicWhat went wrong?After trying the app for the first time on iOS and created my first recording, at a completely stationary location, the slider in the editor didn't work. It complained that it had not enough divisions, which is a variable that it set to the amount of coordinates in the specific recording. This is weird since the RangeSlider requires at least two divisions but every recording under three cords gets deleted. So how did only one cord end up there?I map my coordinates to there specific datetime right here: Points with the same DateTime? Don't we use timestamps?Well,kinda. Sqlite don't really has a timestamp fields and stores datetimes as a string. Yes, a string. The way we get those is by using CURRENT_TIMESTAMP as a default for the datetime field. A quick Are we getting a cord this often?Yes, we are. I've actually set the duration to 800ms. Energy economy. Modern version of android only take these values as a suggestion and only update when they feel like it. This helps to save energy because it prevents bad developed apps, that eat up the battery life of your phone really quickly, existing by not allowing bad energy behavior. So android uses the value more as an min between updates instead of an actually update. The scenario of it actually hitting the same second gets pretty rare and when it happens you normally don't notice in our usecase. Apple takes with one step further by not offering the option to have such a value. The device decides itself when it updates by figuring out if the user actually moved. The only thing a developer can set is the precision of the location which will just shorten the required distance a user has to travel before the update callback is called again. But if you don't travel at all?Well this is where things gets weird. Because if you are completely stationary and you activate the location updates iOS will fire the same location three times in rapid succession at the callback function. This leads to the same location being stored multiple times with the same datetime string. |
While recording with no movement at all (in this cased achieved through simulator) iOS will not trigger or record the coordinates at all. It only does at the beginning once, but it seems like it triggers the callback multiple times. This lead to one recorded coordinate being stored multiple times. This is clearly visible by the fact that they contain the same timestamp.
The text was updated successfully, but these errors were encountered: