GeolocatorPlugin icon indicating copy to clipboard operation
GeolocatorPlugin copied to clipboard

Incorrect assumption on permission checking

Open chrisfoulds opened this issue 6 years ago • 0 comments

The following code makes incorrect assumptions on how an app may be operating. For a fitness app it continues in the background using 'application.beginBackgroundTask(withName: "testapp") {} to deliver audio prompts for what to do next etc. as well as monitoring location as such it only needs locationwheninuse (see runkeeper for an example!) This check sequence below forces users of the plugin to have always permission which is not needed and will result in app store rejection.

(Btw. The above does work, I have in test projects in swift delivered instructions and monitored location for 5hrs +)

`#if IOS

		var permission = Permission.Location;
		if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0))
		{
			if (listenerSettings.AllowBackgroundUpdates)
				permission = Permission.LocationAlways;
			else
				permission = Permission.LocationWhenInUse;
		}

		var hasPermission = await CheckPermissions(permission);


		if (!hasPermission)
			throw new GeolocationException(GeolocationError.Unauthorized);

#endif`

chrisfoulds avatar Jan 25 '19 09:01 chrisfoulds