tlueder / flutter_example_webview_geolocator

2 stars 0 forks source link

Issue : webview_geolocator Not working Properly #1

Open TheSunilVarma opened 4 years ago

TheSunilVarma commented 4 years ago

Starting From this comment : https://github.com/flutter/plugins/pull/1457#issuecomment-575225019

My Last Comment regarding this issue.

@TheSunilVarma please check now.

The geolocator plugin has some trouble to return the correct status. Status permission granted overwrites deactivated...

Hello @tlueder ! Thanks For Your Quick Reply. I have checked into your updated ..timeout = parseInt(data['timeout'] ?? 0) edition.. But nothing changed.... And Yes after digging your code i also think there is some issue with geolocator plugin... But One Thing I have successfuly now able to get location when Location or GPS is turned ON ! But just Switching the value of LocationAccuracy in getCurrentPosition Function...

Before-- position = await geolocator.getCurrentPosition( locationPermissionLevel: GeolocationPermission.locationWhenInUse, desiredAccuracy: (positionOptions.enableHighAccuracy ? LocationAccuracy.best : LocationAccuracy.medium)); Edited-- (Works Fine..) position = await geolocator.getCurrentPosition( locationPermissionLevel: GeolocationPermission.locationWhenInUse, desiredAccuracy: (positionOptions.enableHighAccuracy ? LocationAccuracy.medium : LocationAccuracy.best));

Remaining Issue Something Strange Happening !

See Images : Works on Having Map with Get Location (Dot) button but not works without map View ??? 1th and 2th image is of working after clicking on MAP button right side of 3rd Photo... but does not work after clicking Get Location !.... in image 3rd and 4th.

1 4 2 3

And My Question. Had One Question... is the value of positionOptions.enableHighAccuracy is ever changing from FALSE ? i am not able see changes in value of positionOptions.enableHighAccuracy.

UPDATE I have build Release apk of mine App and now its working on both after turning ON and OFF from GPS notification as said in previous comment was had issue while turned ON GPS,but not now in release apk .... (Only Problem is now of not getting Location after clicking on get Location in website as shown in above images)

Thanks For Your Help and Sorry For The Trouble...

tlueder commented 4 years ago

Don't worry, I have updated the demo app again to show how to set the enableHighAccuracy.

But just to get this out of the way. I have reimplemented the behaviour of the JS GEO API. Have a look here: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API/Using_the_Geolocation_API

Per default the accuracy is set to medium(because it is faster) and can be set to high via position options from the requesting website: https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions

But you are free to set it to what ever you need.

Can you send me the url you are using so I can take a look?

TheSunilVarma commented 4 years ago

Don't worry, I have updated the demo app again to show how to set the enableHighAccuracy.

But just to get this out of the way. I have reimplemented the behaviour of the JS GEO API. Have a look here: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API/Using_the_Geolocation_API

Per default the accuracy is set to medium(because it is faster) and can be set to high via position options from the requesting website: https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions

But you are free to set it to what ever you need.

Can you send me the url you are using so I can take a look?

Yes here it is

  1. https://book.olacabs.com/ -- Have Both Get Location and Map Option Best for Testing...
  2. https://www.uber.com/in/en/ride/ -- Have Get Location does not work at high Accuracy
  3. https://swiggy.com -- Works at Map View after clincking get location dot button....
TheSunilVarma commented 4 years ago

Hello @tlueder !, Have you tested the link is it working fine at your end ? any update ?

tlueder commented 4 years ago

Yes I tested all of them. You have to change line 507 to 509 according to your needs. For some sites a delay is needed for others don't.

For my projects it works well this way. But I only use this on 2 websites. so my sample size is small.