Class Geolocation.PositionOptions

  • Enclosing class:
    Geolocation

    public static class Geolocation.PositionOptions
    extends java.lang.Object
    Additional options for receiving the user's location.
    • Constructor Detail

      • PositionOptions

        public PositionOptions()
    • Method Detail

      • setHighAccuracyEnabled

        public Geolocation.PositionOptions setHighAccuracyEnabled​(boolean enabled)
        Sets whether or not the application will request a more accurate position from the browser.

        If the browser supports this option, the user will be prompted to grant permission to this application, even if permission to get the user's (less accurate) position has already been granted.

        Requesting high accuracy may be slower, or not supported at all, depending on the browser.

        By default this is false

      • setMaximumAge

        public Geolocation.PositionOptions setMaximumAge​(int maximumAge)
        Allows the browser to return a position immediately with a cached position. The maximum age is then the oldest acceptable cached position. If no acceptable cached position is found, the browser will locate the user and cache and return the position.

        By default this is 0, which means that the position cache will not be used.

      • setTimeout

        public Geolocation.PositionOptions setTimeout​(int timeout)
        Sets the amount of time (in milliseconds) that the application is willing to wait before getting the user's position. If a request for position takes more than this amount of time, an error will result.

        By default this is -1, which means there is no application-specified timeout.