예제 #1
0
        internal static AccessState GetCurrentLocationAccess(this AndroidContext context, bool background, bool fineAccess)
        {
            var status = context.GetLocationManagerStatus(false);

            if (status != AccessState.Available)
            {
                return(status);
            }

            if (context.IsMinApiLevel(29) && background)
            {
                status = context.GetCurrentAccessState(ACCESS_BACKGROUND_LOCATION);
                if (status != AccessState.Available)
                {
                    return(status);
                }
            }
            var next = fineAccess ? P.AccessFineLocation : P.AccessCoarseLocation;

            status = context.GetCurrentAccessState(next);

            return(status);
        }