flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

Bug on Samsung Note 10

Open kekedaine opened this issue 7 years ago • 8 comments

i use this command to get location Position position = await Geolocator() .getCurrentPosition(desiredAccuracy: LocationAccuracy.low); But with Samsung Note 10, it does not work. And not run next command and not throw any exception.

kekedaine avatar Sep 12 '19 14:09 kekedaine

Hey @kekedaine, could you please give us some more information about this bug?

ChiefMax avatar Sep 25 '19 12:09 ChiefMax

I have the same issue on Galaxy note 8.

Future getFirstLocation() async {
    Position position;

    print("getfirstlocation");

    GeolocationStatus geolocationStatus  = await Geolocator().checkGeolocationPermissionStatus();

    print("geolocationStatus: ${geolocationStatus}");

    var temp = Geolocator()
        .getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest).catchError((e)=> {print("then")});

    print("temp= $temp");

    try {
      position = await Geolocator()
          .getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
    } catch (error) {
      print("getfirstlocation error 1");
      try {
        position = await Geolocator()
            .getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
      } catch (error) {
        print("error in geolocation $error");
      }
    }

    print("getfirstlocation position: $position");

prints

getfirstlocation geolocationStatus: GeolocationStatus.granted temp= Instance of 'Future'

No errors are thrown nor catched. The Future seems to never resolve nor fail. No code further down in the function is called (which of course breaks my app).

*Edit: This is the only Android phone I have to test on, so can't tell if this works on other phones. But it still works on iOS.

FlashJonas avatar Sep 25 '19 13:09 FlashJonas

Switching out geolocator: ^5.1.3 for the alternative library: location: ^2.3.5 (and updating the code of course) works on Galaxy Note8 as a desperate fix while this is being solved.

FlashJonas avatar Sep 25 '19 14:09 FlashJonas

@FlashJonas Did you try to run the app on an emulator? You could do this to test if the bug depends on the device or the code itself.

Edit: I reproduced your code on an emulator and got the following output: LAT: 37.4219983, LNG: -122.084

StijnWoerkom avatar Oct 03 '19 11:10 StijnWoerkom

Same here on Note 4: the example always return nulls only on that device, it works on my others Android devices

synw avatar Oct 14 '19 11:10 synw

@StijnWoerkom This bug still appears in the latest plugin.

njovy avatar Apr 29 '20 08:04 njovy

I have the same issue on Android emulator ... I try to print the position when a screen is initialized. There is my code :

class _LoadingScreenState extends State<LoadingScreen> {
  void printPosition() async {
    GeolocationStatus geolocationStatus =
        await Geolocator().checkGeolocationPermissionStatus();
    print(geolocationStatus);
    Position position = await Geolocator()
        .getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
    print(position);
  }

  @override
  void initState() {
    print('init');
    super.initState();
    printPosition();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold();
  }
}

And the console result :

I/flutter ( 6254): init I/flutter ( 6254): GeolocationStatus.granted

BrunoJunior avatar Apr 29 '20 22:04 BrunoJunior

This bug is solved with version 6.0.0 of the geolocator plugin.

mvanbeusekom avatar Sep 08 '20 08:09 mvanbeusekom