The use of some members in the API requires a specific license level. Please refer to Licensing details by class.
- Since:
- 100.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds anArcadeConsoleMessageListener
that gets invoked whenever a console message is sent from any Arcade script.static String
Gets the default API key to access API key enabled services and resources in ArcGIS Online.static String
Returns the current API version.static License
Gets the license details about the application.static File
Returns the resources directory.static ServiceCurveGeometryMode
Determines if curve geometries are fetched from and sent to services that support them.static void
Initializes the API by loading dependencies and other client libraries.static boolean
Indicates whether initialization was successful.static boolean
isLinux()
Checks if os.name contains Linux.static boolean
isOsx()
Checks if os.name contains os x.static boolean
Checks if os.name contains win.static boolean
Removes the givenArcadeConsoleMessageListener
if it is present.static void
Sets the default API key to access API key enabled services and resources in ArcGIS Online.static void
setInstallDirectory
(String installDirectory) Sets the directory containing the API libraries and resources.static LicenseResult
setLicense
(LicenseInfo licenseInfo) Licenses the application using the given LicenseInfo, and returns aLicenseResult
indicating the outcome of the license operation.static LicenseResult
setLicense
(String licenseKey) Licenses the application for deployment using the given license string, and returns aLicenseResult
indicating the outcome of the license operation.static LicenseResult
setLicense
(String licenseKey, List<String> extensions) Licenses an application for deployment using an ESRI license string and one or more extension license strings.static void
setServiceCurveGeometryMode
(ServiceCurveGeometryMode serviceCurveGeometryMode) Determines if curve geometries are fetched from and sent to services that support them.
-
Constructor Details
-
ArcGISRuntimeEnvironment
public ArcGISRuntimeEnvironment()
-
-
Method Details
-
getResourcesDirectory
Returns the resources directory. A resources directory is not always required by the API so this method may return a value that does not exist.- Returns:
- the resources directory
- Throws:
IllegalStateException
- if the API has not been initialized- Since:
- 100.0.0
-
initialize
public static void initialize()Initializes the API by loading dependencies and other client libraries.- Throws:
RuntimeException
- if there is a failure- Since:
- 100.0.0
-
isInitialized
public static boolean isInitialized()Indicates whether initialization was successful.- Returns:
- true, if initialized; false otherwise
-
setInstallDirectory
Sets the directory containing the API libraries and resources. This is an optional call, used if you want to override the standard locations for an install.- Parameters:
installDirectory
- directory containing the API libraries and resources- Throws:
RuntimeException
- if this is called after the API has initializedNullPointerException
- if the input value is null- Since:
- 100.0.0
-
isLinux
public static boolean isLinux()Checks if os.name contains Linux.- Returns:
- true, if is Linux
-
isWindows
public static boolean isWindows()Checks if os.name contains win.- Returns:
- true, if is Windows
-
isOsx
public static boolean isOsx()Checks if os.name contains os x.- Returns:
- true, if is OSX
-
getApiVersion
Returns the current API version.- Returns:
- the API version
- Since:
- 100.14.0
-
setLicense
Licenses the application for deployment using the given license string, and returns aLicenseResult
indicating the outcome of the license operation. TheLicenseResult
contains aLicenseStatus
ofINVALID
,EXPIRED
, orVALID
. A deployed application must call this method, which removes the watermark associated withLicenseLevel.DEVELOPER
.Note: If any licensed functionality (license level
LITE
,BASIC
,STANDARD
, orADVANCED
) is accessed before setting the license, an exception will be thrown.- Parameters:
licenseKey
- the ESRI license string. The license will have one of the following levels, defined in theLicenseLevel
enum:LITE
,BASIC
,STANDARD
, orADVANCED
.- Returns:
- the license result of attempting to set the main license
- Since:
- 100.0.0
- See Also:
-
setLicense
Licenses the application using the given LicenseInfo, and returns aLicenseResult
indicating the outcome of the license operation.License info is for named-user access. A
LicenseInfo
can be obtained from a portal for the current logged in user by callingPortal.fetchLicenseInfoAsync()
. TheLicenseInfo
instance is only valid for 30 days, so the user will be required to log into the portal again when this expires.The
LicenseResult
returned by this method contains the license status, which will be one of the following values defined in theLicenseStatus
enum:VALID
,INVALID
,EXPIRED
(if the user's subscription on the portal has expired), orLOGIN_REQUIRED
(if the user needs to log in to the portal to renew theLicenseInfo
).- Parameters:
licenseInfo
- license information used for named-user access. Obtained from a portal.- Returns:
- the license result of attempting to set the main license
- Throws:
IllegalArgumentException
- if licenseInfo is null- Since:
- 100.0.0
- See Also:
-
setLicense
Licenses an application for deployment using an ESRI license string and one or more extension license strings.- Parameters:
licenseKey
- the ESRI license string. The license will have one of the following levels, defined in theLicenseLevel
enum:LITE
,BASIC
,STANDARD
, orADVANCED
.extensions
- a list of extension license strings- Returns:
- the license result of attempting to set the main license
- Throws:
IllegalArgumentException
- if extensions is null- Since:
- 100.0.0
- See Also:
-
getLicense
Gets the license details about the application.The license details includes the
LicenseStatus
,LicenseLevel
, andLicenseType
values for the licensed application. It also contains the expiry date of the license or whether the provided license is perpetual.- Returns:
- the license details about the application
- Since:
- 100.0.0
- See Also:
-
setApiKey
Sets the default API key to access API key enabled services and resources in ArcGIS Online.An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS location services and private portal items. You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the Generate API keys privilege. To learn how to create and manage API keys, go to the Create an API Key tutorial. You must ensure that your API key has the correct privileges to access secure resources.
In addition to setting an
getApiKey()
at a global level for your application, you can set it on any API class that implementsApiKeyResource
. This overrides theArcGISRuntimeEnvironment.getAPIKey()
and enables more granular usage telemetry and management of ArcGIS location resources used by your app.Classes that expose an API key property by implementing
APIKeyResource
include:- Parameters:
apiKey
- the default API key to access API key enabled services and resources in ArcGIS Online- Since:
- 100.10.0
- See Also:
-
getApiKey
Gets the default API key to access API key enabled services and resources in ArcGIS Online.An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS location services and private portal items. You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the Generate API keys privilege. To learn how to create and manage API keys, go to the Create an API Key tutorial. You must ensure that your API key has the correct privileges to access secure resources.
In addition to setting an
getApiKey()
at a global level for your application, you can set it on any API class that implementsApiKeyResource
. This overrides theArcGISRuntimeEnvironment.getAPIKey()
and enables more granular usage telemetry and management of ArcGIS location resources used by your app.Classes that expose an API key property by implementing
APIKeyResource
include:- Returns:
- the default API key to access API key enabled services and resources in ArcGIS Online
- Since:
- 100.10.0
- See Also:
-
getServiceCurveGeometryMode
Determines if curve geometries are fetched from and sent to services that support them.By default, this API does not fetch curves in geometries or act as a true curve client, which means:
- Densified versions of any curve geometries are fetched from services, resulting in client-side geometries
where
Geometry.hasCurves()
is always false. - Curve geometries stored in services where
ArcGISFeatureServiceInfo.isOnlyAllowTrueCurveUpdatesByTrueCurveClients()
is true cannot be updated.
If your application preserves curve segments throughout all workflows, set this property to
ServiceCurveGeometryMode.TRUE_CURVE_CLIENT
, which means:- Curve geometries are fetched from services, resulting in client-side geometries where
Geometry.hasCurves()
is true. - Your app will inform the services that it is a true curve client, and therefore will be able to update
curve geometries stored in services where
ArcGISFeatureServiceInfo.isOnlyAllowTrueCurveUpdatesByTrueCurveClients()
is true.
Ensure that you change this property before any calls to services are made, as it cannot be changed after the first request has begun. Note that some geometry operations do not support curve geometries; see
GeometryEngine
for details of curve support.GeometryEditor
does not support curve geometries. It is your responsibility to ensure data integrity by correctly preserving any curve segments throughout your application when usingArcGISRuntimeEnvironment.getServiceCurveGeometryMode()
.For details of curve support in services, see ArcGIS REST API documentation.
For services that don't support curves, this value has no effect. It also has no effect on local data sources that may contain curve geometries, such as mobile geodatabases or mobile map packages created using ArcGIS Pro.
- Returns:
- determines if curve geometries are fetched from and sent to services that support them
- Since:
- 100.12.0
- See Also:
- Densified versions of any curve geometries are fetched from services, resulting in client-side geometries
where
-
setServiceCurveGeometryMode
Determines if curve geometries are fetched from and sent to services that support them.By default, this API does not fetch curves in geometries or act as a true curve client, which means:
- Densified versions of any curve geometries are fetched from services, resulting in client-side geometries
where
Geometry.hasCurves()
is always false. - Curve geometries stored in services where
ArcGISFeatureServiceInfo.isOnlyAllowTrueCurveUpdatesByTrueCurveClients()
is true cannot be updated.
If your application preserves curve segments throughout all workflows, set this property to
ServiceCurveGeometryMode.TRUE_CURVE_CLIENT
, which means:- Curve geometries are fetched from services, resulting in client-side geometries where
Geometry.hasCurves()
is true. - Your app will inform the services that it is a true curve client, and therefore will be able to update
curve geometries stored in services where
ArcGISFeatureServiceInfo.isOnlyAllowTrueCurveUpdatesByTrueCurveClients()
is true.
For details of curve support in services, see ArcGIS REST API documentation.
For services that don't support curves, this value has no effect. It also has no effect on local data sources that may contain curve geometries, such as mobile geodatabases or mobile map packages created using ArcGIS Pro.
- Parameters:
serviceCurveGeometryMode
- determines if curve geometries are fetched from and sent to services that support them- Throws:
IllegalArgumentException
- if serviceCurveGeometryMode is nullArcGISRuntimeException
- if attempt was made too late to change if curves are fetched from or sent to services- Since:
- 100.12.0
- See Also:
- Densified versions of any curve geometries are fetched from services, resulting in client-side geometries
where
-
addArcadeConsoleMessageListener
Adds anArcadeConsoleMessageListener
that gets invoked whenever a console message is sent from any Arcade script.This callback allows clients to retrieve messages from evaluating an Arcade script expression in an attribute rule, labeling, popup, dictionary renderer, geotrigger, and more.
Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- Parameters:
listener
- anArcadeConsoleMessageListener
that gets invoked whenever a console message is sent- Throws:
IllegalArgumentException
- if listener is null- Since:
- 100.14.0
- See Also:
-
removeArcadeConsoleMessageListener
Removes the givenArcadeConsoleMessageListener
if it is present.- Parameters:
listener
- theArcadeConsoleMessageListener
to remove- Returns:
- true if the listener has been removed, otherwise false
- Throws:
IllegalArgumentException
- if listener is null- Since:
- 100.14.0
- See Also:
-