Class AndroidLocationDataSource

    • Constructor Detail

      • AndroidLocationDataSource

        public AndroidLocationDataSource​(android.content.Context context)
        Creates a new AndroidLocationDataSource with the given Context. The platform GPS and network location providers are used, if they are enabled. The minimum time between updates defaults to 100 milliseconds, and the minimum distance between location updates defaults to 0.0 meters.
        Parameters:
        context - the Context that the MapView of the associated LocationDisplay is running in
        Throws:
        java.lang.IllegalArgumentException - if context is null
        Since:
        100.0.0
      • AndroidLocationDataSource

        public AndroidLocationDataSource​(android.content.Context context,
                                         android.location.Criteria criteria,
                                         long minTime,
                                         float minDistance)
        Creates a new instance of AndroidLocationDataSource based on the given provider Criteria, with the given minimum update frequency and minimum location distance change.

        Not all location providers can return all types of location information. Use the criteria parameter to specify what kind of information or properties are required for this AndroidLocationDataSource; for example one that has low power usage, avoids network usage, or that includes bearing or altitude information.

        Parameters:
        context - the Context that the MapView of the associated LocationDisplay is running in
        criteria - the set of requirements that the selected location provider must satisfy
        minTime - the minimum time interval at which location updates should be received, in milliseconds
        minDistance - the minimum distance between which location updates should be received, in meters
        Throws:
        java.lang.IllegalArgumentException - if minTime or minDistance is negative
        Since:
        100.0.0
      • AndroidLocationDataSource

        public AndroidLocationDataSource​(android.content.Context context,
                                         java.lang.String provider,
                                         long minTime,
                                         float minDistance)
        Creates a new instance of AndroidLocationDataSource based on the given provider name, with the given minimum update frequency and minimum location distance change.

        Provider names are defined as constants of the android.location.LocationManager class.

        Parameters:
        context - the Context that the MapView of the associated LocationDisplay is running in
        provider - the name of the underlying Android platform location provider to use, for example 'gps'
        minTime - the minimum time interval at which location updates should be received, in milliseconds
        minDistance - the minimum distance between which location updates should be received, in meters
        Throws:
        java.lang.IllegalArgumentException - if minTime or minDistance is negative
        Since:
        100.0.0
    • Method Detail

      • requestLocationUpdates

        public void requestLocationUpdates​(android.location.Criteria criteria,
                                           long minTime,
                                           float minDistance)
        Changes the location update parameters to use the given provider Criteria, minimum update frequency, and minimum location distance change. Applies only when LocationDataSource.isStarted() is true.
        Parameters:
        criteria - the set of requirements that the selected location provider must satisfy
        minTime - the minimum time interval at which location updates should be received, in milliseconds
        minDistance - the minimum distance between which location updates should be received, in meters
        Throws:
        java.lang.IllegalArgumentException - if minTime or minDistance is negative, or criteria is null,or no location provider matches the criteria
        java.lang.IllegalStateException - if no location provider is selected by the criteria, or data source is not started
        Since:
        100.0.0
      • requestLocationUpdates

        public void requestLocationUpdates​(java.lang.String provider,
                                           long minTime,
                                           float minDistance)
        Changes the location update parameters to use the given provider name, minimum update frequency, and minimum location distance change. Applies only when LocationDataSource.isStarted() is true.
        Parameters:
        provider - the name of the underlying Android platform location provider to use, for example 'gps'
        minTime - the minimum time interval at which location updates should be received, in milliseconds
        minDistance - the minimum distance of location change at which location updates should be received, in meters
        Throws:
        java.lang.IllegalArgumentException - if minTime or minDistance is negative, or criteria is null
        java.lang.IllegalStateException - the specified location provider is not found in the location manager, or data source is not started
        Since:
        100.0.0