Enum Class GeolocationAvailability
java.lang.Object
java.lang.Enum<GeolocationAvailability>
com.vaadin.flow.component.geolocation.GeolocationAvailability
- All Implemented Interfaces:
Serializable,Comparable<GeolocationAvailability>,Constable
Whether the browser can read the user's location right now, and if so what
permission state the origin has.
Returned by Geolocation.getAvailability(). Reading the value does
not show a permission dialog — it reports whether a dialog would
appear on the next Geolocation.get(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.geolocation.GeolocationResult>) or Geolocation.track(com.vaadin.flow.component.Component) call,
or whether the call would fail regardless because the feature is unusable in
this context.
Typical usage:
UNSUPPORTED— hide the location control entirely; no user action can change this.DENIED— pre-explain to the user why location is blocked and how to re-enable it in the browser settings.GRANTED— safe to auto-fetch silently on return visits.PROMPT/UNKNOWN— wait for an explicit user action (click a button) before triggering a browser prompt.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe user has previously denied permission for this origin.The user has previously granted permission for this origin.Permission has not yet been decided.The browser did not report a permission state.The geolocation feature is unusable in the current page context — the page is served over an insecure connection (plain HTTP rather than HTTPS orlocalhost), or it is embedded in an iframe whose Permissions-Policy blocks geolocation. -
Method Summary
Modifier and TypeMethodDescriptionstatic GeolocationAvailabilityReturns the enum constant of this class with the specified name.static GeolocationAvailability[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
GRANTED
The user has previously granted permission for this origin. A subsequentGeolocation.get(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.geolocation.GeolocationResult>)orGeolocation.track(com.vaadin.flow.component.Component)call will proceed without showing a dialog. -
DENIED
The user has previously denied permission for this origin. Subsequent calls will fail withGeolocationErrorCode.PERMISSION_DENIEDwithout re-prompting. The only way to change this is for the user to update the site permissions in their browser settings. -
PROMPT
Permission has not yet been decided. The nextGeolocation.get(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.geolocation.GeolocationResult>)orGeolocation.track(com.vaadin.flow.component.Component)call will show the browser's permission dialog. -
UNKNOWN
The browser did not report a permission state. Treat this as "do not auto-fetch; wait for the user to take an explicit action". Safari always returns this value because it does not implement permission querying for geolocation. -
UNSUPPORTED
The geolocation feature is unusable in the current page context — the page is served over an insecure connection (plain HTTP rather than HTTPS orlocalhost), or it is embedded in an iframe whose Permissions-Policy blocks geolocation. No user action can change this, so applications should hide location-related controls entirely instead of offering a button that would always fail.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-