Class ArcGISRuntimeEnvironment


  • public class ArcGISRuntimeEnvironment
    extends java.lang.Object
    Provides access to and manipulation of the API environment settings, such as configurations for the operating environment and licenses for deployment.

    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 Detail

      • ArcGISRuntimeEnvironment

        public ArcGISRuntimeEnvironment()
    • Method Detail

      • getResourcesDirectory

        public static java.io.File 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:
        java.lang.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:
        java.lang.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

        public static void setInstallDirectory​(java.lang.String installDirectory)
        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:
        java.lang.RuntimeException - if this is called after the API has initialized
        java.lang.NullPointerException - 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

        public static java.lang.String getApiVersion()
        Returns the current API version.
        Returns:
        the API version
        Since:
        100.14.0
      • setLicense

        public static LicenseResult setLicense​(LicenseInfo licenseInfo)
        Licenses the application using the given LicenseInfo, and returns a LicenseResult 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 calling Portal.fetchLicenseInfoAsync(). The LicenseInfo 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 the LicenseStatus enum: VALID, INVALID, EXPIRED (if the user's subscription on the portal has expired), or LOGIN_REQUIRED (if the user needs to log in to the portal to renew the LicenseInfo).

        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:
        java.lang.IllegalArgumentException - if licenseInfo is null
        Since:
        100.0.0
        See Also:
        setLicense(String), setLicense(String, List), LicenseStatus
      • setLicense

        public static LicenseResult setLicense​(java.lang.String licenseKey,
                                               java.util.List<java.lang.String> extensions)
        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 the LicenseLevel enum: LITE, BASIC, STANDARD, or ADVANCED.
        extensions - a list of extension license strings
        Returns:
        the license result of attempting to set the main license
        Throws:
        java.lang.IllegalArgumentException - if extensions is null
        Since:
        100.0.0
        See Also:
        setLicense(String), setLicense(LicenseInfo)
      • setApiKey

        public static void setApiKey​(java.lang.String apiKey)
        Sets the default API key to access API key enabled services and resources in ArcGIS Online.

        An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.

        In addition to setting an getApiKey() at a global level for your application, you can set it on any API class that implements ApiKeyResource. This overrides the ArcGISRuntimeEnvironment.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()
      • getServiceCurveGeometryMode

        public static ServiceCurveGeometryMode getServiceCurveGeometryMode()
        Determines if curve geometries are fetched from and sent to services that support them.

        By default, curve geometries are not fetched from services that support curves, meaning that densified versions of any curve geometries are fetched from the service.

        By default, the API is not a true curve enabled client when sending updates to services that support curves. This means that curve geometries stored in services where ArcGISFeatureServiceInfo.isOnlyAllowTrueCurveUpdatesByTrueCurveClients() is true cannot be updated by default. To update such geometries, ensure your app correctly handles curve segments (where Segment.isCurve() is true) in geometries throughout the workflow and set this property to ServiceCurveGeometryMode.TRUE_CURVE_CLIENT. You must do this before any calls to services are made - it cannot be changed after making the first request.

        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.

        Some geometry operations do not support curve geometries; see GeometryEngine for details of curve support. SketchEditor does not support curve geometries.

        Returns:
        determines if curve geometries are fetched from and sent to services that support them
        Since:
        100.12.0
        See Also:
        Geometry.hasCurves()
      • setServiceCurveGeometryMode

        public static void setServiceCurveGeometryMode​(ServiceCurveGeometryMode serviceCurveGeometryMode)
        Determines if curve geometries are fetched from and sent to services that support them.

        By default, curve geometries are not fetched from services that support curves, meaning that densified versions of any curve geometries are fetched from the service.

        By default, the API is not a true curve enabled client when sending updates to services that support curves. This means that curve geometries stored in services where ArcGISFeatureServiceInfo.isOnlyAllowTrueCurveUpdatesByTrueCurveClients() is true cannot be updated by default. To update such geometries, ensure your app correctly handles curve segments in geometries throughout the workflow and set this property to ServiceCurveGeometryMode.TRUE_CURVE_CLIENT. You must do this before any calls to services are made - it cannot be changed after making the first request.

        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.

        Some geometry operations do not support curve geometries; see GeometryEngine for details of curve support. SketchEditor does not support curve geometries.

        Parameters:
        serviceCurveGeometryMode - determines if curve geometries are fetched from and sent to services that support them
        Throws:
        java.lang.IllegalArgumentException - if serviceCurveGeometryMode is null
        ArcGISRuntimeException - if attempt was made too late to change if curves are fetched from or sent to services
        Since:
        100.12.0
        See Also:
        Geometry.hasCurves()
      • addArcadeConsoleMessageListener

        public static void addArcadeConsoleMessageListener​(ArcadeConsoleMessageListener listener)
        Adds an ArcadeConsoleMessageListener 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 - an ArcadeConsoleMessageListener that gets invoked whenever a console message is sent
        Throws:
        java.lang.IllegalArgumentException - if listener is null
        Since:
        100.14.0
        See Also:
        removeArcadeConsoleMessageListener(ArcadeConsoleMessageListener)