Skip to content
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

[feat] adding basic geolocation #13

Draft
wants to merge 101 commits into
base: master
Choose a base branch
from

Conversation

Alystrasz
Copy link
Member

Using geolocator package, the app receives a location every ~5 seconds (if the user consents + if geolocation is enabled on the phone).

@rouvoy rouvoy requested a review from m3ftah April 23, 2020 07:43
@rouvoy rouvoy added the enhancement New feature or request label Apr 23, 2020
@rouvoy rouvoy added this to the 0.1 milestone Apr 23, 2020
@Alystrasz
Copy link
Member Author

LocationOptions(accuracy: LocationAccuracy.best, timeInterval: 5000)
With this, we receive a location every few seconds, which might impact phone's battery: is it possible/reasonable to increase this interval?

@rouvoy
Copy link
Contributor

rouvoy commented Apr 23, 2020

I believe that we can live with one location retrieved every 1 or 2 minutes. Most of the visited places will be indoor places, so we can also rely on Google Play services to locate the phone with minimum battery consumption (by using alternative location technology), if available on Flutter.

@Alystrasz
Copy link
Member Author

Geolocator package already uses Google Play services (at least on Android, the implementation being a FusedLocationProviderClient), so that should do it 😃
I'll increase the location timeout to 60 seconds.

@m3ftah
Copy link
Contributor

m3ftah commented May 4, 2020

The app has asked for location permission, there is no bug.
How can we test this feature?

@Alystrasz
Copy link
Member Author

For now, the app requests a location every 60 seconds; each time a location is received, it is printed on the logs.

@m3ftah
Copy link
Contributor

m3ftah commented May 4, 2020

Nothing is printed on the log.
I am using a Simulator.

@m3ftah
Copy link
Contributor

m3ftah commented May 4, 2020

Have you tried to see if it works even if you close the app, or switch to another app on Android?

@Alystrasz
Copy link
Member Author

I launched the app, switched to a browser, and it seems that it gathers locations while in background (tested on Android 6)

D/FlutterView(31752): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@6f59ceb 
I/flutter (31752): new location stored: {lat: 51.0286983, lng: 2.3703206, date: 2020-05-04 12:15:15.774Z}
I/flutter (31752): new location stored: {lat: 51.0286983, lng: 2.3703206, date: 2020-05-04 12:16:15.809Z}
I/flutter (31752): new location stored: {lat: 51.0286982, lng: 2.3703206, date: 2020-05-04 12:17:15.890Z}
I/flutter (31752): new location stored: {lat: 51.0286982, lng: 2.3703206, date: 2020-05-04 12:18:15.915Z}

@m3ftah
Copy link
Contributor

m3ftah commented May 4, 2020

Good, could you also check if this takes more than 15 minutes, as Android seems to idle apps if they are not on the foreground.

@Alystrasz
Copy link
Member Author

What would we do if this takes more than 15 minutes?

@m3ftah
Copy link
Contributor

m3ftah commented May 5, 2020

You mean if it doesn't take more than 15 minutes?

@Alystrasz
Copy link
Member Author

Well, the more locations we have, the most accurate our results will be.
Moreover, we can't force people to activate geolocation on their phones, so receiving a new location definitely might take more than 15 minutes 😄

…rent day

While computing locations and visited places to display on the
visitedPlacesCard component, which is meant to show map elements
for the present day only, we filter locations to retain those from
present day.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants