Class CLLocationManager

  • All Implemented Interfaces:
    NSObject

    public class CLLocationManager
    extends NSObject
    CLLocationManager Discussion: The CLLocationManager object is your entry point to the location service. API-Since: 2.0
    • Constructor Detail

      • CLLocationManager

        protected CLLocationManager​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static CLLocationManager allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • authorizationStatus_static

        @Deprecated
        public static int authorizationStatus_static()
        Deprecated.
        authorizationStatus Discussion: Deprecated. Use the instance property authorizationStatus instead. API-Since: 4.2 Deprecated-Since: 14.0
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • deferredLocationUpdatesAvailable

        @Deprecated
        public static boolean deferredLocationUpdatesAvailable()
        Deprecated.
        API-Since: 6.0 Deprecated-Since: 13.0 Deprecated-Message: You can remove calls to this method
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • headingAvailable_static

        public static boolean headingAvailable_static()
        headingAvailable Discussion: Returns YES if the device supports the heading service, otherwise NO. API-Since: 4.0
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isMonitoringAvailableForClass

        public static boolean isMonitoringAvailableForClass​(@NotNull
                                                            @NotNull org.moe.natj.objc.Class regionClass)
        isMonitoringAvailableForClass: Discussion: Determines whether the device supports monitoring for the specified type of region. If NO, all attempts to monitor the specified type of region will fail. API-Since: 7.0
      • isRangingAvailable

        public static boolean isRangingAvailable()
        isRangingAvailable Discussion: Determines whether the device supports ranging. If NO, all attempts to range beacons will fail. API-Since: 7.0
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • locationServicesEnabled_static

        public static boolean locationServicesEnabled_static()
        locationServicesEnabled Discussion: Determines whether the user has location services enabled. If NO, and you proceed to call other CoreLocation API, user will be prompted with the warning dialog. You may want to check this property and use location services only when explicitly requested by the user. API-Since: 4.0
      • regionMonitoringAvailable

        @Deprecated
        public static boolean regionMonitoringAvailable()
        Deprecated.
        regionMonitoringAvailable Discussion: Deprecated. Use +isMonitoringAvailableForClass: instead. API-Since: 4.0 Deprecated-Since: 7.0
      • regionMonitoringEnabled

        @Deprecated
        public static boolean regionMonitoringEnabled()
        Deprecated.
        regionMonitoringEnabled Discussion: Deprecated. Use +isMonitoringAvailableForClass: and -authorizationStatus instead. API-Since: 4.0 Deprecated-Since: 6.0 Deprecated-Message: Use +isMonitoringAvailableForClass: and -authorizationStatus instead
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • significantLocationChangeMonitoringAvailable

        public static boolean significantLocationChangeMonitoringAvailable()
        significantLocationChangeMonitoringAvailable Discussion: Returns YES if the device supports significant location change monitoring, otherwise NO. API-Since: 4.0
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • activityType

        public long activityType()
        activityType Discussion: Specifies the type of user activity. Currently affects behavior such as the determination of when location updates may be automatically paused. By default, CLActivityTypeOther is used. API-Since: 6.0
      • allowDeferredLocationUpdatesUntilTraveledTimeout

        @Deprecated
        public void allowDeferredLocationUpdatesUntilTraveledTimeout​(double distance,
                                                                     double timeout)
        Deprecated.
        API-Since: 6.0 Deprecated-Since: 13.0 Deprecated-Message: You can remove calls to this method
      • allowsBackgroundLocationUpdates

        public boolean allowsBackgroundLocationUpdates()
        API-Since: 9.0
      • desiredAccuracy

        public double desiredAccuracy()
        desiredAccuracy Discussion: The desired location accuracy. The location service will try its best to achieve your desired accuracy. However, it is not guaranteed. To optimize power performance, be sure to specify an appropriate accuracy for your usage scenario (eg, use a large accuracy value when only a coarse location is needed). Use kCLLocationAccuracyBest to achieve the best possible accuracy. Use kCLLocationAccuracyBestForNavigation for navigation. The default value varies by platform.
      • disallowDeferredLocationUpdates

        @Deprecated
        public void disallowDeferredLocationUpdates()
        Deprecated.
        API-Since: 6.0 Deprecated-Since: 13.0 Deprecated-Message: You can remove calls to this method
      • dismissHeadingCalibrationDisplay

        public void dismissHeadingCalibrationDisplay()
        API-Since: 3.0
      • distanceFilter

        public double distanceFilter()
        distanceFilter Discussion: Specifies the minimum update distance in meters. Client will not be notified of movements of less than the stated value, unless the accuracy has improved. Pass in kCLDistanceFilterNone to be notified of all movements. By default, kCLDistanceFilterNone is used.
      • heading

        @Nullable
        public @Nullable CLHeading heading()
        API-Since: 4.0
      • headingAvailable

        @Deprecated
        public boolean headingAvailable()
        Deprecated.
        API-Since: 3.0 Deprecated-Since: 4.0
      • headingFilter

        public double headingFilter()
        API-Since: 3.0
      • headingOrientation

        public int headingOrientation()
        API-Since: 4.0
      • location

        @Nullable
        public @Nullable CLLocation location()
        location Discussion: The last location received. Will be nil until a location has been received.
      • locationServicesEnabled

        @Deprecated
        public boolean locationServicesEnabled()
        Deprecated.
        API-Since: 2.0 Deprecated-Since: 4.0
      • maximumRegionMonitoringDistance

        public double maximumRegionMonitoringDistance()
        API-Since: 4.0
      • monitoredRegions

        @NotNull
        public @NotNull NSSet<? extends CLRegion> monitoredRegions()
        API-Since: 4.0
      • pausesLocationUpdatesAutomatically

        public boolean pausesLocationUpdatesAutomatically()
        pausesLocationUpdatesAutomatically Discussion: Specifies that location updates may automatically be paused when possible. By default, this is YES for applications linked against iOS 6.0 or later. API-Since: 6.0
      • purpose

        @Nullable
        @Deprecated
        public @Nullable java.lang.String purpose()
        Deprecated.
        API-Since: 3.2 Deprecated-Since: 6.0 Deprecated-Message: Set the purpose string in Info.plist using key NSLocationUsageDescription
      • rangedRegions

        @NotNull
        @Deprecated
        public @NotNull NSSet<? extends CLRegion> rangedRegions()
        Deprecated.
        API-Since: 7.0 Deprecated-Since: 13.0 Deprecated-Message: Use -rangedBeaconConstraints
      • requestAlwaysAuthorization

        public void requestAlwaysAuthorization()
        API-Since: 8.0
      • requestLocation

        public void requestLocation()
        requestLocation Discussion: Request a single location update. The service will attempt to determine location with accuracy according to the desiredAccuracy property. The location update will be delivered via the standard delegate callback, i.e. locationManager:didUpdateLocations: If the best available location has lower accuracy, then it will be delivered via the standard delegate callback after timeout. If no location can be determined, the locationManager:didFailWithError: delegate callback will be delivered with error location unknown. There can only be one outstanding location request and this method can not be used concurrently with startUpdatingLocation or allowDeferredLocationUpdates. Calling either of those methods will immediately cancel the location request. The method stopUpdatingLocation can be used to explicitly cancel the request. API-Since: 9.0
      • requestStateForRegion

        @Deprecated
        public void requestStateForRegion​(@NotNull
                                          @NotNull CLRegion region)
        Deprecated.
        API-Since: 5.0 Deprecated-Since: 100000.0
      • requestWhenInUseAuthorization

        public void requestWhenInUseAuthorization()
        requestWhenInUseAuthorization Discussion: When -authorizationStatus == kCLAuthorizationStatusNotDetermined, calling this method will trigger a prompt to request "when-in-use" authorization from the user. Any authorization change as a result of the prompt will be reflected via the usual delegate callback: -locationManager:didChangeAuthorizationStatus:. If possible, perform this call in response to direct user request for a location-based service so that the reason for the prompt will be clear, and the utility of a one-time grant is maximized. If received, "when-in-use" authorization grants access to the user's location via any CoreLocation API as long as your app is being actively used by the user. Typically this means your app must be in the foreground. If you start a Continuous Background Location session (see -allowsBackgroundLocationUpdates), then CoreLocation will maintain visibility for your app as it enters the background. This will enable your app to continue receiving location information even as another app enters the foreground. Your app will remain visible in this way until location updates are stopped or your app is killed by the user. When -authorizationStatus != kCLAuthorizationStatusNotDetermined, (ie generally after the first call) this method will do nothing. If your app is not currently in use, this method will do nothing. The NSLocationWhenInUseUsageDescription key must be specified in your Info.plist; otherwise, this method will do nothing, as your app will be assumed not to support WhenInUse authorization. API-Since: 8.0
      • setActivityType

        public void setActivityType​(long value)
        activityType Discussion: Specifies the type of user activity. Currently affects behavior such as the determination of when location updates may be automatically paused. By default, CLActivityTypeOther is used. API-Since: 6.0
      • setAllowsBackgroundLocationUpdates

        public void setAllowsBackgroundLocationUpdates​(boolean value)
        API-Since: 9.0
      • setDesiredAccuracy

        public void setDesiredAccuracy​(double value)
        desiredAccuracy Discussion: The desired location accuracy. The location service will try its best to achieve your desired accuracy. However, it is not guaranteed. To optimize power performance, be sure to specify an appropriate accuracy for your usage scenario (eg, use a large accuracy value when only a coarse location is needed). Use kCLLocationAccuracyBest to achieve the best possible accuracy. Use kCLLocationAccuracyBestForNavigation for navigation. The default value varies by platform.
      • setDistanceFilter

        public void setDistanceFilter​(double value)
        distanceFilter Discussion: Specifies the minimum update distance in meters. Client will not be notified of movements of less than the stated value, unless the accuracy has improved. Pass in kCLDistanceFilterNone to be notified of all movements. By default, kCLDistanceFilterNone is used.
      • setHeadingFilter

        public void setHeadingFilter​(double value)
        API-Since: 3.0
      • setHeadingOrientation

        public void setHeadingOrientation​(int value)
        API-Since: 4.0
      • setPausesLocationUpdatesAutomatically

        public void setPausesLocationUpdatesAutomatically​(boolean value)
        pausesLocationUpdatesAutomatically Discussion: Specifies that location updates may automatically be paused when possible. By default, this is YES for applications linked against iOS 6.0 or later. API-Since: 6.0
      • setPurpose

        @Deprecated
        public void setPurpose​(@Nullable
                               @Nullable java.lang.String value)
        Deprecated.
        API-Since: 3.2 Deprecated-Since: 6.0 Deprecated-Message: Set the purpose string in Info.plist using key NSLocationUsageDescription
      • startMonitoringForRegion

        @Deprecated
        public void startMonitoringForRegion​(@NotNull
                                             @NotNull CLRegion region)
        Deprecated.
        API-Since: 5.0 Deprecated-Since: 100000.0
      • startMonitoringForRegionDesiredAccuracy

        @Deprecated
        public void startMonitoringForRegionDesiredAccuracy​(@NotNull
                                                            @NotNull CLRegion region,
                                                            double accuracy)
        Deprecated.
        startMonitoringForRegion:desiredAccuracy: Discussion: Start monitoring the specified region. desiredAccuracy represents the distance past the border of the region at which the application would like to be notified that the region border has been crossed. This is useful to prevent repeated notifications when the user is on the border of the region. This value will be honored on a best-effort basis, and may not be respected if desiredAccuracy is large with respect to the size of the region, or if the device is not capable of providing the precision desired. If a region of the same type with the same identifier is already being monitored for this application, it will be removed from monitoring. This is done asynchronously and may not be immediately reflected in monitoredRegions. API-Since: 4.0 Deprecated-Since: 6.0
      • startMonitoringSignificantLocationChanges

        public void startMonitoringSignificantLocationChanges()
        API-Since: 4.0
      • startMonitoringVisits

        public void startMonitoringVisits()
        API-Since: 8.0
      • startRangingBeaconsInRegion

        @Deprecated
        public void startRangingBeaconsInRegion​(@NotNull
                                                @NotNull CLBeaconRegion region)
        Deprecated.
        API-Since: 7.0 Deprecated-Since: 13.0 Deprecated-Message: Use -startRangingBeaconsSatisfyingConstraint:
      • startUpdatingHeading

        public void startUpdatingHeading()
        API-Since: 3.0
      • startUpdatingLocation

        public void startUpdatingLocation()
        startUpdatingLocation Discussion: Start updating locations.
      • stopMonitoringForRegion

        @Deprecated
        public void stopMonitoringForRegion​(@NotNull
                                            @NotNull CLRegion region)
        Deprecated.
        API-Since: 5.0 Deprecated-Since: 100000.0
      • stopMonitoringSignificantLocationChanges

        public void stopMonitoringSignificantLocationChanges()
        API-Since: 4.0
      • stopMonitoringVisits

        public void stopMonitoringVisits()
        API-Since: 8.0
      • stopRangingBeaconsInRegion

        @Deprecated
        public void stopRangingBeaconsInRegion​(@NotNull
                                               @NotNull CLBeaconRegion region)
        Deprecated.
        API-Since: 7.0 Deprecated-Since: 13.0 Deprecated-Message: Use -stopRangingBeaconsSatisfyingConstraint:
      • stopUpdatingHeading

        public void stopUpdatingHeading()
        API-Since: 3.0
      • stopUpdatingLocation

        public void stopUpdatingLocation()
        stopUpdatingLocation Discussion: Stop updating locations.
      • setShowsBackgroundLocationIndicator

        public void setShowsBackgroundLocationIndicator​(boolean value)
        showsBackgroundLocationIndicator Discussion: Specifies that an indicator be shown when the app makes use of continuous background location updates. Starting continuous background location updates requires the app to set UIBackgroundModes to include "location" and to set the property allowsBackgroundLocationUpdates to YES before calling -startUpdatingLocation with the intent to continue in the background. Note that this property only applies to apps with Always authorization. For apps with WhenInUse authorization, the indicator is always shown when using continuous background location updates in order to maintain user visibility and that the app is still in use. The default value of this property is NO. API-Since: 11.0
      • showsBackgroundLocationIndicator

        public boolean showsBackgroundLocationIndicator()
        showsBackgroundLocationIndicator Discussion: Specifies that an indicator be shown when the app makes use of continuous background location updates. Starting continuous background location updates requires the app to set UIBackgroundModes to include "location" and to set the property allowsBackgroundLocationUpdates to YES before calling -startUpdatingLocation with the intent to continue in the background. Note that this property only applies to apps with Always authorization. For apps with WhenInUse authorization, the indicator is always shown when using continuous background location updates in order to maintain user visibility and that the app is still in use. The default value of this property is NO. API-Since: 11.0
      • startRangingBeaconsSatisfyingConstraint

        public void startRangingBeaconsSatisfyingConstraint​(@NotNull
                                                            @NotNull CLBeaconIdentityConstraint constraint)
        API-Since: 13.0
      • stopRangingBeaconsSatisfyingConstraint

        public void stopRangingBeaconsSatisfyingConstraint​(@NotNull
                                                           @NotNull CLBeaconIdentityConstraint constraint)
        API-Since: 13.0
      • accuracyAuthorization

        public long accuracyAuthorization()
        accuracyAuthorization Discussion: Returns information about the calling application's access to accurate location. See the documentation for CLAccuracyAuthorization for information about how to interpret the return value. Note that this property should generally be interpreted in the context of the authorizationStatus property. For example, if authorizationStatus == kCLAuthorizationStatusNotDetermined then accurate location information cannot be received even when accuracyAuthorization is CLAccuracyAuthorizationFullAccuracy. API-Since: 14.0
      • authorizationStatus

        public int authorizationStatus()
        authorizationStatus Discussion: Returns the current authorization status of the calling application. API-Since: 14.0
      • isAuthorizedForWidgetUpdates

        public boolean isAuthorizedForWidgetUpdates()
        authorizedForWidgetUpdates Discussion: Returns true if widgets of the calling application may be eligible to receive location updates. If the calling application has authorizationStatus == kCLAuthorizationStatusAuthorizedWhenInUse, and authorizedForWidgetUpdates == YES, then widgets will be able to get location updates if called upon to refresh within a few minutes of having been seen. If the calling application has authorizationStatus == kCLAuthorizationStatusAuthorizedAlways, then authorizedForWidgetUpdates will always be YES. API-Since: 14.0
      • requestTemporaryFullAccuracyAuthorizationWithPurposeKey

        public void requestTemporaryFullAccuracyAuthorizationWithPurposeKey​(@NotNull
                                                                            @NotNull java.lang.String purposeKey)
        requestTemporaryFullAccuracyAuthorizationWithPurposeKey: Discussion: This is a variant of requestTemporaryAccurateLocationAuthorizationWithPurposeKey:completion: which doesn't take a completion block. This is equivalent to passing in a nil completion block. API-Since: 14.0
      • requestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletion

        public void requestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletion​(@NotNull
                                                                                      @NotNull java.lang.String purposeKey,
                                                                                      @Nullable
                                                                                      @Nullable CLLocationManager.Block_requestTemporaryFullAccuracyAuthorizationWithPurposeKeyCompletion completion)
        requestTemporaryFullAccuracyAuthorizationWithPurposeKey:completion: Discussion: If your app doesn't have permission to access accurate location (see -accuracyAuthorization), you can use this method to request temporary access to accurate location. This access will expire automatically, but it won't expire while the user is still engaged with your app. So, for example, while your app is in the foreground your app will retain the temporary access it was granted. Similarly, if your app starts a Continuous Background Location session with the background location indicator enabled (see -showsBackgroundLocationIndicator), your access to accurate location will remain as long as the background location indicator remains enabled. This allows your app to provide session-oriented experiences which require accurate location (e.g. fitness or navigation), even if the user has decided not to grant your app persistent access to accurate location. When CoreLocation prepares the prompt for display, it will look at the NSLocationTemporaryUsageDescriptionDictionary key in your Info.plist. The value should be a dictionary containing usage descriptions. The purposeKey you provide to this method must correspond to an entry in that dictionary. To retrieve a localized string, CoreLocation will load your InfoPlist.strings file and try to look up a string using the purposeKey you provided. If that fails, CoreLocation will use the content provided in your Info.plist. For example, suppose your Info.plist contains the following. NSLocationTemporaryUsageDescriptionDictionary ExampleUsageDescription This app needs accurate location so it can verify that you're in a supported region. AnotherUsageDescription This app needs accurate location so it can show you relevant results. In this case, you would be able to provide either "ExampleUsageDescription" or "AnotherUsageDescription" for the purposeKey argument. Passing any other string would result in the prompt not being displayed. To localize these usage descriptions, you would add entries for "ExampleUsageDescription" and "AnotherUsageDescription" to your InfoPlist.strings file. CoreLocation may decide against showing the user a prompt. For example, if your app already has access to accurate location or it is currently in the background. When that happens, your completion block will be called with an appropriate NSError. If the user responded to the prompt, your completion block will be called with a nil error. At that point, you may query the state of your CLLocationManager to see if you have been granted accurate access. The completion block will be called in the same threading context where delegate callbacks occur. That is, it will be called on the runloop where the CLLocationManager was originally initialized. API-Since: 14.0
      • stopMonitoringLocationPushes

        public void stopMonitoringLocationPushes()
        API-Since: 15.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.