Search code examples
fluttergps

Permisson handler - location do not work (Flutter)


I have a problem with Permisson Handler while try to use location.

When i tap and run gps func everything seems fine. Pop up is showing up I can choose options - Allow, Allow while Using etc, however when I choose allow or allow while it do not turn on location. It was working perfectly and just stopped somehow (permission is set to granted).

When I turn it on manually (Location on my device) everything is like it was before. I don't now why this prompt stops turning on location service.

void _onGpsTap() async {
    bloc.emitEvent(DisplayProgressIndicator());
    try {
      permissionStatus = await Permission.location.status;
      if (permissionStatus.isUndetermined) {
        permissionStatus = await Permission.location.request(); // Here I'm asking for turning location on
      }
      if (permissionStatus.isDenied) {...

I'm using

geolocator: ^5.3.1
permission_handler: 5.0.0+hotfix.3

Solution

  • I found out that is not possible to turn on location service via. flutter and the user have to do it maunally.