Enum Class GeolocationErrorCode
- All Implemented Interfaces:
Serializable,Comparable<GeolocationErrorCode>,Constable
Typed reasons why a geolocation request can fail.
Returned by GeolocationError.errorCode(). Prefer this enum over
comparing raw numbers — exhaustive switch catches missing branches at
compile time.
Each constant holds an integer identifier. Applications rarely need to look
at code() directly; it is exposed for logging and for round-tripping
with GeolocationError.code().
-
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 refused to share their location — typically by clicking "Block" on the browser's permission dialog, or by previously denying permission for this origin.The browser tried to determine a position but failed — for example because the device has no GPS signal and no network positioning is available, or because the operating system refused the request.The browser did not produce a position within the time budget set byGeolocationOptions.The browser reported a numeric error code that this version of Flow does not recognise. -
Method Summary
Modifier and TypeMethodDescriptionintcode()Returns the integer identifier of this error code, or-1forUNKNOWN.static GeolocationErrorCodefromCode(int code) Looks up the enum constant for a raw numeric code, returningUNKNOWNif the code is not one this version of Flow recognises.static GeolocationErrorCodeReturns the enum constant of this class with the specified name.static GeolocationErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PERMISSION_DENIED
The user refused to share their location — typically by clicking "Block" on the browser's permission dialog, or by previously denying permission for this origin. Once denied, the browser will keep returning this code until the user re-enables location for the site in their browser settings. -
POSITION_UNAVAILABLE
The browser tried to determine a position but failed — for example because the device has no GPS signal and no network positioning is available, or because the operating system refused the request. Usually transient; showing a retry button is a reasonable response. -
TIMEOUT
The browser did not produce a position within the time budget set byGeolocationOptions. Either the user is in a difficult-to-locate environment or the timeout was too tight. -
UNKNOWN
The browser reported a numeric error code that this version of Flow does not recognise.GeolocationError.code()still holds the raw value for logging or custom handling.
-
-
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
-
code
public int code()Returns the integer identifier of this error code, or-1forUNKNOWN. Mainly useful for logging or interoperating withGeolocationError.code().- Returns:
- the numeric code, or
-1forUNKNOWN
-
fromCode
Looks up the enum constant for a raw numeric code, returningUNKNOWNif the code is not one this version of Flow recognises. This is howGeolocationError.errorCode()behaves — it maps known codes to constants and surfaces unknown future codes asUNKNOWNrather than throwing.- Parameters:
code- the numeric error code- Returns:
- the matching constant, or
UNKNOWNif unrecognised
-