Use a license in your app

Production licenses can be applied in one of two ways:

  • Using a license string.
  • Using a user authentication workflow.

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.

License string

A license string is a text string provided by Esri that is used to enable a production license.

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 if your users or the app fall under one of the following categories:

  • Users do not have an ArcGIS account with an ArcGIS Online organization or on-premises ArcGIS Enterprise 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 the ArcGIS Location Platform site (sign in required). Basic, Standard, and Advanced license strings are purchased as ArcGIS Runtime 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).

User authentication

User authentication is an authentication method where a user signs in to your app with an ArcGIS account in ArcGIS Online or ArcGIS Enterprise. 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 ArcGIS Runtime license 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.

How to use a license string in your app

You can get your Lite license string for free by signing into your ArcGIS Location Platform account.

Your Runtime Lite license string


Using a license string involves adding code to set the license level at compile time 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.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
        val licenseKey = LicenseKey.create("runtimelite,1000,rud#########,day-month-year,####################")
            ?: return showError("Null license string. ")
        val licenseResult = ArcGISEnvironment.setLicense(licenseKey)

Your app is now licensed for production use.

How to use user authentication in your app

Use of user authentication involves adding code to enable sign in with an ArcGIS account. 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.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
        // 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}")
            }

            // license the app using the license info
            val licenseResult = ArcGISEnvironment.setLicense(licenseInfo)
            showLicenseResult(licenseResult)

        }

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.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
            // 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)

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.