medyas / flutter_qiblah

Flutter Qiblah is a plugin that allows you to display Qiblah direction in you app with support for both Android and iOS.
https://pub.dev/packages/flutter_qiblah
MIT License
127 stars 91 forks source link

Unknown Location Service error #1

Closed n2ng-dev closed 4 years ago

n2ng-dev commented 4 years ago

I got Error Unknown Location Service error, Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-24 at 18 26 02

medyas commented 4 years ago

As i see in the screenshot, you running on iOS, have you added the permission in infop.list ? Also are you running on an simulator ?

The part of the code responsible for this is : it seem like it detects that you have enabled the Location Service, but its not working

    StreamBuilder(
        stream: stream,
        builder: (context, AsyncSnapshot<LocationStatus> snapshot) {
          if (snapshot.connectionState == ConnectionState.waiting)
            return LoadingIndicator();
          if (snapshot.data.enabled == true) {
            switch (snapshot.data.status) {
              case GeolocationStatus.granted:
                return QiblahCompassWidget();

              case GeolocationStatus.denied:
                return LocationErrorWidget(
                  error: "Location service permission denied",
                  callback: _checkLocationStatus,
                );
              case GeolocationStatus.disabled:
                return LocationErrorWidget(
                  error: "Location service disabled",
                  callback: _checkLocationStatus,
                );
              case GeolocationStatus.unknown:
                return LocationErrorWidget(
                  error: "Unknown Location service error",
                  callback: _checkLocationStatus,
                );
              default:
                return Container();
            }
          } else {
            return LocationErrorWidget(
              error: "Please enable Location service",
              callback: _checkLocationStatus,
            );
          }
        },
      )
medyas commented 4 years ago

I am closing this, as no information is provided.