requestTemporaryFullAccuracy method

  1. @override
Future<LocationAccuracyStatus> requestTemporaryFullAccuracy({
  1. required String purposeKey,
})

Asks the user for Temporary Precise location access (iOS 14 or above).

Returns LocationAccuracyStatus.precise if the user already gave permission to use Precise Accuracy. If the user uses iOS 13 or below, LocationAccuracyStatus.precise will also be returned. On other platforms an PlatformException will be thrown.

The required property purposeKey should correspond with the key value set in the NSLocationTemporaryUsageDescriptionDictionary dictionary, which should be added to the Info.plist as stated in the documentation.

Throws a PermissionDefinitionsNotFoundException when the key NSLocationTemporaryUsageDescriptionDictionary has not been set in the Infop.list.

Implementation

@override
Future<LocationAccuracyStatus> requestTemporaryFullAccuracy({
  required String purposeKey,
}) async {
  try {
    final int status = await _methodChannel.invokeMethod(
      'requestTemporaryFullAccuracy',
      <String, dynamic>{
        'purposeKey': purposeKey,
      },
    );
    return LocationAccuracyStatus.values[status];
  } on PlatformException catch (e) {
    final error = _handlePlatformException(e);
    throw error;
  }
}