Production licenses can be applied in one of two ways:

  • Using a user authentication User authentication is a type of authentication that allows users with an ArcGIS account to sign into an application and allow it to access ArcGIS content, services, and resources on their behalf. The typical authorization protocol used is OAuth2.0. Learn more workflow.
  • Using a license string A license string is a string of characters developers add to their application code to license their use of applications built with ArcGIS Maps SDKs for Native Apps and to unlock certain capabilities on the deployment device. Learn more .

The option you choose will depend on the nature of your app and whether your app’s users will sign in to your app using an ArcGIS account.

User authentication

User authentication User authentication is a type of authentication that allows users with an ArcGIS account to sign into an application and allow it to access ArcGIS content, services, and resources on their behalf. The typical authorization protocol used is OAuth2.0. Learn more is an authentication method where a user signs in to your app with an ArcGIS account An ArcGIS account is an identity with a user type and set of privileges that can access specific ArcGIS products, tools, APIs, services, and resources. The main account types that can be used for development are an ArcGIS Location Platform account, ArcGIS Online account, and ArcGIS Enterprise account. ArcGIS Location Platform and ArcGIS Online accounts are also associated with a subscription. Learn more in ArcGIS Online ArcGIS Online is a GIS mapping, analytics, data hosting, and content management software as a service (SaaS) product. It includes applications, tools, APIs, and location services for users and developers. It is subscription-based and requires an ArcGIS Online account. Learn more or ArcGIS Enterprise. ArcGIS Enterprise is a GIS mapping, analytics, data hosting, and content management product that can be hosted on-premise or in a cloud infrastructure. It includes software, applications, tools, APIs, and services for users and developers. Learn more The ArcGIS account of the user can be assigned a production license.

Your app should allow a user to sign in using their ArcGIS account, and must include code to read and apply the license associated with their authenticated account. See how to use user authentication in your app for more information.

The administrator of the ArcGIS organization to which your app user belongs must assign a suitable user type to your app user’s ArcGIS account. See Get a license for more information.

The production license obtained from user authentication travels with the user, not the app, allowing a user to license many apps.

License string

A license string A license string is a string of characters developers add to their application code to license their use of applications built with ArcGIS Maps SDKs for Native Apps and to unlock certain capabilities on the deployment device. Learn more is a text string provided by Esri that is used to enable a production license. Note that a license string A license string is a string of characters developers add to their application code to license their use of applications built with ArcGIS Maps SDKs for Native Apps and to unlock certain capabilities on the deployment device. Learn more is not an API key An API key is a long-lived access token created using API key credentials. They are valid for up to one year and are typically embedded directly into client applications. Learn more . A license string specifies a production license level, which determines the SDK capabilities available in your deployed app, while an API key authorizes access to location services and secured portal items. For more information on API keys, see Api key authentication.

Your app must include code to apply the license string. See how to use a license string in your app for more details.

Use a license string A license string is a string of characters developers add to their application code to license their use of applications built with ArcGIS Maps SDKs for Native Apps and to unlock certain capabilities on the deployment device. Learn more if your users or the app fall under one of the following categories:

  • Users do not have an ArcGIS account with an ArcGIS Online ArcGIS Online is a GIS mapping, analytics, data hosting, and content management software as a service (SaaS) product. It includes applications, tools, APIs, and location services for users and developers. It is subscription-based and requires an ArcGIS Online account. Learn more organization or on-premises ArcGIS Enterprise ArcGIS Enterprise is a GIS mapping, analytics, data hosting, and content management product that can be hosted on-premise or in a cloud infrastructure. It includes software, applications, tools, APIs, and services for users and developers. Learn more portal.
  • Your app makes use of SDK capabilities before a user signs in with their ArcGIS account.
  • Your app will remain offline indefinitely, or will function if offline for a duration of more than 30 days.

Your free Lite level license string is obtained from My Esri (sign in required). Basic, Standard, and Advanced license strings are purchased as ArcGIS Maps SDKs for Native Apps license deployment packs. See Get a license for more information.

A Lite license string includes unlimited production deployments.

For Basic, Standard, and Advanced license strings, the ArcGIS Runtime license deployment pack defines how many production deployments are permitted (a deployment is counted per app, install, and user).

How to use user authentication in your app

Use of user authentication User authentication is a type of authentication that allows users with an ArcGIS account to sign into an application and allow it to access ArcGIS content, services, and resources on their behalf. The typical authorization protocol used is OAuth2.0. Learn more involves adding code to enable sign in with an ArcGIS account An ArcGIS account is an identity with a user type and set of privileges that can access specific ArcGIS products, tools, APIs, services, and resources. The main account types that can be used for development are an ArcGIS Location Platform account, ArcGIS Online account, and ArcGIS Enterprise account. ArcGIS Location Platform and ArcGIS Online accounts are also associated with a subscription. Learn more . At runtime, a user must successfully sign in to return their license information, which is used by the app to set the license level. Follow these steps to license your app using the member’s account:

  1. Find a location in your code that runs before any SDK functionality is used.
  2. Allow the app user to authenticate with an ArcGIS organizational account. Upon loading the Portal obtain the LicenseInfo and use this to license the app. As part of the process, save the license information in preparation for the app being used in an offline environment for up to 30 days.

The following example shows how to get a license for an ArcGIS Online member.

// connect to the portal (ArcGIS Online) using the credential
val portal = Portal.arcGISOnline(Portal.Connection.Authenticated)
lifecycleScope.launch {
portal.load().getOrElse { error ->
return@launch showError("Error loading portal: ${error.message}")
}
// fetch LicenseInfo from the portal
val licenseInfo = portal.fetchLicenseInfo().getOrElse { error ->
return@launch showError("Error fetching licenseInfo: ${error.message}")
}
try {
// license the app using the license info
val licenseResult = ArcGISEnvironment.setLicense(licenseInfo)
showLicenseResult(licenseResult)
}
catch(e: LicensingException) {
showError("Unable to set license: ${e.message}")
}
}

Your app is now licensed for production use.

If you saved the license information on local storage, your app can be started and licensed in an offline environment using the saved license information. Retrieve the license from storage and license your app.

// get the LicenseInfo as JSON formatted text
val licenseJson = licenseInfo.toJson()
// ... save text string locally ...
// (on startup) ... get the license JSON stored on the device ...
// set the license info from the saved JSON string
val licenseInfoFromJson = LicenseInfo.fromJsonOrNull(licenseJson)

How to use a license string in your app

Using a license string A license string is a string of characters developers add to their application code to license their use of applications built with ArcGIS Maps SDKs for Native Apps and to unlock certain capabilities on the deployment device. Learn more involves adding code during application development to set the license level so that the license string is built into the application.

  1. Find a location in your code that runs before any SDK functionality is used.
  2. Call the setLicense() method on the ArcGISEnvironment singleton object to license the app with a license string and any extension licenses.

The following example shows how to set a license string without extensions.

val licenseKey = LicenseKey.create("runtimelite,1000,rud#########,day-month-year,####################")
?: return showError("Null license string.")
try {
val licenseResult = ArcGISEnvironment.setLicense(licenseKey)
showLicenseResult(licenseResult)
}
catch(e: LicensingException) {
showError("Unable to set license: ${e.message}")
}

Your app is now licensed for production use.