cordova.plugins.diagnostic 7.2.9 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +567 -456
- package/cordova.plugins.diagnostic.d.ts +65 -1
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/Diagnostic.java +78 -0
- package/src/ios/Diagnostic.h +2 -0
- package/src/ios/Diagnostic.m +26 -0
- package/src/ios/Diagnostic_Bluetooth.m +3 -1
- package/src/ios/Diagnostic_Location.m +35 -0
- package/www/android/diagnostic.js +59 -1
- package/www/ios/diagnostic.js +38 -2
- package/www/ios/diagnostic.location.js +19 -3
- package/.specstory/.project.json +0 -8
package/README.md
CHANGED
|
@@ -2,378 +2,382 @@ Cordova diagnostic plugin [
|
|
10
|
-
- [Important notes](#important-notes)
|
|
11
|
-
- [Minimum supported versions](#minimum-supported-versions)
|
|
12
|
-
- [Native environment required](#native-environment-required)
|
|
13
|
-
- [Building for Android](#building-for-android)
|
|
14
|
-
- [Installation](#installation)
|
|
15
|
-
- [Using the Cordova/Phonegap/Ionic CLI](#using-the-cordovaphonegapionic-cli)
|
|
16
|
-
- [AndroidX Library](#androidx-library)
|
|
17
|
-
- [Specifying modules](#specifying-modules)
|
|
18
|
-
- [Available modules](#available-modules)
|
|
19
|
-
- [Reporting issues](#reporting-issues)
|
|
20
|
-
- [Reporting a bug or problem](#reporting-a-bug-or-problem)
|
|
21
|
-
- [Requesting a new feature](#requesting-a-new-feature)
|
|
22
|
-
- [Usage](#usage)
|
|
23
|
-
- [Core module](#core-module)
|
|
24
|
-
- [switchToSettings()](#switchtosettings)
|
|
25
|
-
- [Parameters](#parameters)
|
|
26
|
-
- [Example usage](#example-usage)
|
|
27
|
-
- [switchToWirelessSettings()](#switchtowirelesssettings)
|
|
28
|
-
- [switchToMobileDataSettings()](#switchtomobiledatasettings)
|
|
29
|
-
- [permissionStatus constants](#permissionstatus-constants)
|
|
30
|
-
- [Android](#android)
|
|
31
|
-
- [iOS](#ios)
|
|
32
|
-
- [Example](#example)
|
|
33
|
-
- [getPermissionAuthorizationStatus()](#getpermissionauthorizationstatus)
|
|
34
|
-
- [Parameters](#parameters-1)
|
|
35
|
-
- [Example usage](#example-usage-1)
|
|
36
|
-
- [getPermissionsAuthorizationStatus()](#getpermissionsauthorizationstatus)
|
|
37
|
-
- [Parameters](#parameters-2)
|
|
38
|
-
- [Example usage](#example-usage-2)
|
|
39
|
-
- [requestRuntimePermission()](#requestruntimepermission)
|
|
40
|
-
- [Parameters](#parameters-3)
|
|
41
|
-
- [Example usage](#example-usage-3)
|
|
42
|
-
- [requestRuntimePermissions()](#requestruntimepermissions)
|
|
43
|
-
- [Parameters](#parameters-4)
|
|
44
|
-
- [Example usage](#example-usage-4)
|
|
45
|
-
- [isRequestingPermission()](#isrequestingpermission)
|
|
46
|
-
- [Example usage](#example-usage-5)
|
|
47
|
-
- [registerPermissionRequestCompleteHandler()](#registerpermissionrequestcompletehandler)
|
|
48
|
-
- [Parameters](#parameters-5)
|
|
49
|
-
- [Example usage](#example-usage-6)
|
|
50
|
-
- [isDataRoamingEnabled()](#isdataroamingenabled)
|
|
51
|
-
- [Parameters](#parameters-6)
|
|
52
|
-
- [Example usage](#example-usage-7)
|
|
53
|
-
- [isADBModeEnabled()](#isadbmodeenabled)
|
|
54
|
-
- [Parameters](#parameters-7)
|
|
55
|
-
- [Example usage](#example-usage-8)
|
|
56
|
-
- [isDeviceRooted()](#isdevicerooted)
|
|
57
|
-
- [Parameters](#parameters-8)
|
|
58
|
-
- [Example usage](#example-usage-9)
|
|
59
|
-
- [isBackgroundRefreshAuthorized()](#isbackgroundrefreshauthorized)
|
|
60
|
-
- [Parameters](#parameters-9)
|
|
61
|
-
- [Example usage](#example-usage-10)
|
|
62
|
-
- [getBackgroundRefreshStatus()](#getbackgroundrefreshstatus)
|
|
63
|
-
- [Parameters](#parameters-10)
|
|
64
|
-
- [Example usage](#example-usage-11)
|
|
65
|
-
- [cpuArchitecture constants](#cpuarchitecture-constants)
|
|
66
|
-
- [Android](#android-1)
|
|
67
|
-
- [iOS](#ios-1)
|
|
68
|
-
- [Example usage](#example-usage-12)
|
|
69
|
-
- [getArchitecture()](#getarchitecture)
|
|
70
|
-
- [Parameters](#parameters-11)
|
|
71
|
-
- [Example usage](#example-usage-13)
|
|
72
|
-
- [restart()](#restart)
|
|
73
|
-
- [Parameters](#parameters-12)
|
|
74
|
-
- [Example usage](#example-usage-14)
|
|
75
|
-
- [enableDebug()](#enabledebug)
|
|
76
|
-
- [Parameters](#parameters-13)
|
|
77
|
-
- [Example usage](#example-usage-15)
|
|
78
|
-
- [getCurrentBatteryLevel()](#getcurrentbatterylevel)
|
|
79
|
-
- [Parameters](#parameters-14)
|
|
80
|
-
- [Example usage](#example-usage-16)
|
|
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
|
-
- [Example](#example-
|
|
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
|
-
- [Example
|
|
145
|
-
- [
|
|
146
|
-
- [Parameters](#parameters-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
- [
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
- [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
- [
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
- [
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
- [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
- [
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
- [
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
- [
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
- [
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
- [
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
- [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
- [
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
- [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
- [
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
- [
|
|
253
|
-
|
|
254
|
-
- [
|
|
255
|
-
- [
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
- [
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
- [
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
- [
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
- [
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
- [
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
- [
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
- [
|
|
282
|
-
|
|
283
|
-
- [
|
|
284
|
-
- [Parameters](#parameters-
|
|
285
|
-
- [Example usage](#example-usage-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
- [
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
- [
|
|
292
|
-
|
|
293
|
-
- [
|
|
294
|
-
- [Parameters](#parameters-
|
|
295
|
-
- [Example usage](#example-usage-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
- [
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
- [
|
|
302
|
-
|
|
303
|
-
- [
|
|
304
|
-
- [Parameters](#parameters-
|
|
305
|
-
- [Example usage](#example-usage-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
- [
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
- [
|
|
312
|
-
|
|
313
|
-
- [
|
|
314
|
-
- [
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
- [
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
- [
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
- [
|
|
327
|
-
|
|
328
|
-
- [
|
|
329
|
-
- [
|
|
330
|
-
- [Example](#example-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
- [
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
- [
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
- [
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
- [
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
- [
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
- [
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
- [
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
- [
|
|
357
|
-
- [
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
- [
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
- [
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
- [iOS](#ios-
|
|
372
|
-
- [
|
|
373
|
-
- [
|
|
374
|
-
- [
|
|
375
|
-
|
|
376
|
-
|
|
5
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
6
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
- [Overview](#overview)
|
|
10
|
+
- [Important notes](#important-notes)
|
|
11
|
+
- [Minimum supported versions](#minimum-supported-versions)
|
|
12
|
+
- [Native environment required](#native-environment-required)
|
|
13
|
+
- [Building for Android](#building-for-android)
|
|
14
|
+
- [Installation](#installation)
|
|
15
|
+
- [Using the Cordova/Phonegap/Ionic CLI](#using-the-cordovaphonegapionic-cli)
|
|
16
|
+
- [AndroidX Library](#androidx-library)
|
|
17
|
+
- [Specifying modules](#specifying-modules)
|
|
18
|
+
- [Available modules](#available-modules)
|
|
19
|
+
- [Reporting issues](#reporting-issues)
|
|
20
|
+
- [Reporting a bug or problem](#reporting-a-bug-or-problem)
|
|
21
|
+
- [Requesting a new feature](#requesting-a-new-feature)
|
|
22
|
+
- [Usage](#usage)
|
|
23
|
+
- [Core module](#core-module)
|
|
24
|
+
- [switchToSettings()](#switchtosettings)
|
|
25
|
+
- [Parameters](#parameters)
|
|
26
|
+
- [Example usage](#example-usage)
|
|
27
|
+
- [switchToWirelessSettings()](#switchtowirelesssettings)
|
|
28
|
+
- [switchToMobileDataSettings()](#switchtomobiledatasettings)
|
|
29
|
+
- [permissionStatus constants](#permissionstatus-constants)
|
|
30
|
+
- [Android](#android)
|
|
31
|
+
- [iOS](#ios)
|
|
32
|
+
- [Example](#example)
|
|
33
|
+
- [getPermissionAuthorizationStatus()](#getpermissionauthorizationstatus)
|
|
34
|
+
- [Parameters](#parameters-1)
|
|
35
|
+
- [Example usage](#example-usage-1)
|
|
36
|
+
- [getPermissionsAuthorizationStatus()](#getpermissionsauthorizationstatus)
|
|
37
|
+
- [Parameters](#parameters-2)
|
|
38
|
+
- [Example usage](#example-usage-2)
|
|
39
|
+
- [requestRuntimePermission()](#requestruntimepermission)
|
|
40
|
+
- [Parameters](#parameters-3)
|
|
41
|
+
- [Example usage](#example-usage-3)
|
|
42
|
+
- [requestRuntimePermissions()](#requestruntimepermissions)
|
|
43
|
+
- [Parameters](#parameters-4)
|
|
44
|
+
- [Example usage](#example-usage-4)
|
|
45
|
+
- [isRequestingPermission()](#isrequestingpermission)
|
|
46
|
+
- [Example usage](#example-usage-5)
|
|
47
|
+
- [registerPermissionRequestCompleteHandler()](#registerpermissionrequestcompletehandler)
|
|
48
|
+
- [Parameters](#parameters-5)
|
|
49
|
+
- [Example usage](#example-usage-6)
|
|
50
|
+
- [isDataRoamingEnabled()](#isdataroamingenabled)
|
|
51
|
+
- [Parameters](#parameters-6)
|
|
52
|
+
- [Example usage](#example-usage-7)
|
|
53
|
+
- [isADBModeEnabled()](#isadbmodeenabled)
|
|
54
|
+
- [Parameters](#parameters-7)
|
|
55
|
+
- [Example usage](#example-usage-8)
|
|
56
|
+
- [isDeviceRooted()](#isdevicerooted)
|
|
57
|
+
- [Parameters](#parameters-8)
|
|
58
|
+
- [Example usage](#example-usage-9)
|
|
59
|
+
- [isBackgroundRefreshAuthorized()](#isbackgroundrefreshauthorized)
|
|
60
|
+
- [Parameters](#parameters-9)
|
|
61
|
+
- [Example usage](#example-usage-10)
|
|
62
|
+
- [getBackgroundRefreshStatus()](#getbackgroundrefreshstatus)
|
|
63
|
+
- [Parameters](#parameters-10)
|
|
64
|
+
- [Example usage](#example-usage-11)
|
|
65
|
+
- [cpuArchitecture constants](#cpuarchitecture-constants)
|
|
66
|
+
- [Android](#android-1)
|
|
67
|
+
- [iOS](#ios-1)
|
|
68
|
+
- [Example usage](#example-usage-12)
|
|
69
|
+
- [getArchitecture()](#getarchitecture)
|
|
70
|
+
- [Parameters](#parameters-11)
|
|
71
|
+
- [Example usage](#example-usage-13)
|
|
72
|
+
- [restart()](#restart)
|
|
73
|
+
- [Parameters](#parameters-12)
|
|
74
|
+
- [Example usage](#example-usage-14)
|
|
75
|
+
- [enableDebug()](#enabledebug)
|
|
76
|
+
- [Parameters](#parameters-13)
|
|
77
|
+
- [Example usage](#example-usage-15)
|
|
78
|
+
- [getCurrentBatteryLevel()](#getcurrentbatterylevel)
|
|
79
|
+
- [Parameters](#parameters-14)
|
|
80
|
+
- [Example usage](#example-usage-16)
|
|
81
|
+
- [isLowPowerModeEnabled()](#islowpowermodeenabled)
|
|
82
|
+
- [onLowPowerModeChange()](#onlowpowermodechange)
|
|
83
|
+
- [isIgnoringBatteryOptimizations()](#isignoringbatteryoptimizations)
|
|
84
|
+
- [requestIgnoreBatteryOptimizations()](#requestignorebatteryoptimizations)
|
|
85
|
+
- [isAirplaneModeEnabled()](#isairplanemodeenabled)
|
|
86
|
+
- [Parameters](#parameters-15)
|
|
87
|
+
- [Example usage](#example-usage-17)
|
|
88
|
+
- [isMobileDataEnabled()](#ismobiledataenabled)
|
|
89
|
+
- [Parameters](#parameters-16)
|
|
90
|
+
- [Example usage](#example-usage-18)
|
|
91
|
+
- [isMobileDataAuthorized()](#ismobiledataauthorized)
|
|
92
|
+
- [Parameters](#parameters-17)
|
|
93
|
+
- [Example usage](#example-usage-19)
|
|
94
|
+
- [isAccessibilityModeEnabled()](#isaccessibilitymodeenabled)
|
|
95
|
+
- [Parameters](#parameters-18)
|
|
96
|
+
- [Example usage](#example-usage-20)
|
|
97
|
+
- [isTouchExplorationEnabled()](#istouchexplorationenabled)
|
|
98
|
+
- [Parameters](#parameters-19)
|
|
99
|
+
- [Example usage](#example-usage-21)
|
|
100
|
+
- [getDeviceOSVersion()](#getdeviceosversion)
|
|
101
|
+
- [Parameters](#parameters-20)
|
|
102
|
+
- [Example usage](#example-usage-22)
|
|
103
|
+
- [getBuildOSVersion()](#getbuildosversion)
|
|
104
|
+
- [Parameters](#parameters-21)
|
|
105
|
+
- [Example usage](#example-usage-23)
|
|
106
|
+
- [isDebugBuild()](#isdebugbuild)
|
|
107
|
+
- [Parameters](#parameters-22)
|
|
108
|
+
- [Example usage](#example-usage-24)
|
|
109
|
+
- [Location module](#location-module)
|
|
110
|
+
- [locationMode constants](#locationmode-constants)
|
|
111
|
+
- [Values](#values)
|
|
112
|
+
- [Example](#example-1)
|
|
113
|
+
- [locationAuthorizationMode constants](#locationauthorizationmode-constants)
|
|
114
|
+
- [Values](#values-1)
|
|
115
|
+
- [Example](#example-2)
|
|
116
|
+
- [locationAccuracyAuthorization constants](#locationaccuracyauthorization-constants)
|
|
117
|
+
- [Values](#values-2)
|
|
118
|
+
- [isLocationAvailable()](#islocationavailable)
|
|
119
|
+
- [Parameters](#parameters-23)
|
|
120
|
+
- [Example usage](#example-usage-25)
|
|
121
|
+
- [isLocationEnabled()](#islocationenabled)
|
|
122
|
+
- [Parameters](#parameters-24)
|
|
123
|
+
- [Example usage](#example-usage-26)
|
|
124
|
+
- [isGpsLocationAvailable()](#isgpslocationavailable)
|
|
125
|
+
- [Parameters](#parameters-25)
|
|
126
|
+
- [Example usage](#example-usage-27)
|
|
127
|
+
- [isGpsLocationEnabled()](#isgpslocationenabled)
|
|
128
|
+
- [Parameters](#parameters-26)
|
|
129
|
+
- [Example usage](#example-usage-28)
|
|
130
|
+
- [isCompassAvailable()](#iscompassavailable)
|
|
131
|
+
- [Parameters](#parameters-27)
|
|
132
|
+
- [Example usage](#example-usage-29)
|
|
133
|
+
- [isNetworkLocationAvailable()](#isnetworklocationavailable)
|
|
134
|
+
- [Parameters](#parameters-28)
|
|
135
|
+
- [Example usage](#example-usage-30)
|
|
136
|
+
- [isNetworkLocationEnabled()](#isnetworklocationenabled)
|
|
137
|
+
- [Parameters](#parameters-29)
|
|
138
|
+
- [Example usage](#example-usage-31)
|
|
139
|
+
- [getLocationMode()](#getlocationmode)
|
|
140
|
+
- [Parameters](#parameters-30)
|
|
141
|
+
- [Example usage](#example-usage-32)
|
|
142
|
+
- [isLocationAuthorized()](#islocationauthorized)
|
|
143
|
+
- [Parameters](#parameters-31)
|
|
144
|
+
- [Example usage](#example-usage-33)
|
|
145
|
+
- [getLocationAuthorizationStatus()](#getlocationauthorizationstatus)
|
|
146
|
+
- [Parameters](#parameters-32)
|
|
147
|
+
- [Example iOS usage](#example-ios-usage)
|
|
148
|
+
- [Example Android usage](#example-android-usage)
|
|
149
|
+
- [getLocationAuthorizationStatuses()](#getlocationauthorizationstatuses)
|
|
150
|
+
- [Parameters](#parameters-33)
|
|
151
|
+
- [requestLocationAuthorization()](#requestlocationauthorization)
|
|
152
|
+
- [Parameters](#parameters-34)
|
|
153
|
+
- [Example usage](#example-usage-34)
|
|
154
|
+
- [registerLocationStateChangeHandler()](#registerlocationstatechangehandler)
|
|
155
|
+
- [Parameters](#parameters-35)
|
|
156
|
+
- [Example usage](#example-usage-35)
|
|
157
|
+
- [getLocationAccuracyAuthorization()](#getlocationaccuracyauthorization)
|
|
158
|
+
- [Parameters](#parameters-36)
|
|
159
|
+
- [Example usage](#example-usage-36)
|
|
160
|
+
- [requestTemporaryFullAccuracyAuthorization()](#requesttemporaryfullaccuracyauthorization)
|
|
161
|
+
- [Parameters](#parameters-37)
|
|
162
|
+
- [Example usage](#example-usage-37)
|
|
163
|
+
- [registerLocationAccuracyAuthorizationChangeHandler()](#registerlocationaccuracyauthorizationchangehandler)
|
|
164
|
+
- [Parameters](#parameters-38)
|
|
165
|
+
- [Example usage](#example-usage-38)
|
|
166
|
+
- [switchToLocationSettings()](#switchtolocationsettings)
|
|
167
|
+
- [Bluetooth module](#bluetooth-module)
|
|
168
|
+
- [bluetoothState constants](#bluetoothstate-constants)
|
|
169
|
+
- [Android](#android-2)
|
|
170
|
+
- [iOS](#ios-2)
|
|
171
|
+
- [Example](#example-3)
|
|
172
|
+
- [isBluetoothAvailable()](#isbluetoothavailable)
|
|
173
|
+
- [Parameters](#parameters-39)
|
|
174
|
+
- [Example usage](#example-usage-39)
|
|
175
|
+
- [isBluetoothEnabled()](#isbluetoothenabled)
|
|
176
|
+
- [Parameters](#parameters-40)
|
|
177
|
+
- [Example usage](#example-usage-40)
|
|
178
|
+
- [hasBluetoothSupport()](#hasbluetoothsupport)
|
|
179
|
+
- [Parameters](#parameters-41)
|
|
180
|
+
- [Example usage](#example-usage-41)
|
|
181
|
+
- [hasBluetoothLESupport()](#hasbluetoothlesupport)
|
|
182
|
+
- [Parameters](#parameters-42)
|
|
183
|
+
- [Example usage](#example-usage-42)
|
|
184
|
+
- [hasBluetoothLEPeripheralSupport()](#hasbluetoothleperipheralsupport)
|
|
185
|
+
- [Parameters](#parameters-43)
|
|
186
|
+
- [Example usage](#example-usage-43)
|
|
187
|
+
- [getBluetoothState()](#getbluetoothstate)
|
|
188
|
+
- [Parameters](#parameters-44)
|
|
189
|
+
- [Example usage](#example-usage-44)
|
|
190
|
+
- [setBluetoothState()](#setbluetoothstate)
|
|
191
|
+
- [Parameters](#parameters-45)
|
|
192
|
+
- [Example usage](#example-usage-45)
|
|
193
|
+
- [getBluetoothAuthorizationStatus()](#getbluetoothauthorizationstatus)
|
|
194
|
+
- [Parameters](#parameters-46)
|
|
195
|
+
- [Example usage](#example-usage-46)
|
|
196
|
+
- [getBluetoothAuthorizationStatuses()](#getbluetoothauthorizationstatuses)
|
|
197
|
+
- [Parameters](#parameters-47)
|
|
198
|
+
- [Example usage](#example-usage-47)
|
|
199
|
+
- [requestBluetoothAuthorization()](#requestbluetoothauthorization)
|
|
200
|
+
- [Parameters](#parameters-48)
|
|
201
|
+
- [Example usage](#example-usage-48)
|
|
202
|
+
- [registerBluetoothStateChangeHandler()](#registerbluetoothstatechangehandler)
|
|
203
|
+
- [Parameters](#parameters-49)
|
|
204
|
+
- [Example usage](#example-usage-49)
|
|
205
|
+
- [switchToBluetoothSettings()](#switchtobluetoothsettings)
|
|
206
|
+
- [WiFi module](#wifi-module)
|
|
207
|
+
- [isWifiAvailable()](#iswifiavailable)
|
|
208
|
+
- [Parameters](#parameters-50)
|
|
209
|
+
- [Example usage](#example-usage-50)
|
|
210
|
+
- [isWifiEnabled()](#iswifienabled)
|
|
211
|
+
- [Parameters](#parameters-51)
|
|
212
|
+
- [Example usage](#example-usage-51)
|
|
213
|
+
- [isLocalNetworkAuthorized()](#islocalnetworkauthorized)
|
|
214
|
+
- [Parameters](#parameters-52)
|
|
215
|
+
- [Example usage](#example-usage-52)
|
|
216
|
+
- [getLocalNetworkAuthorizationStatus()](#getlocalnetworkauthorizationstatus)
|
|
217
|
+
- [Parameters](#parameters-53)
|
|
218
|
+
- [Example usage](#example-usage-53)
|
|
219
|
+
- [requestLocalNetworkAuthorization()](#requestlocalnetworkauthorization)
|
|
220
|
+
- [Parameters](#parameters-54)
|
|
221
|
+
- [Example usage](#example-usage-54)
|
|
222
|
+
- [setWifiState()](#setwifistate)
|
|
223
|
+
- [Parameters](#parameters-55)
|
|
224
|
+
- [Example usage](#example-usage-55)
|
|
225
|
+
- [switchToWifiSettings()](#switchtowifisettings)
|
|
226
|
+
- [Camera module](#camera-module)
|
|
227
|
+
- [isCameraPresent()](#iscamerapresent)
|
|
228
|
+
- [Parameters](#parameters-56)
|
|
229
|
+
- [Example usage](#example-usage-56)
|
|
230
|
+
- [isCameraAvailable()](#iscameraavailable)
|
|
231
|
+
- [Parameters](#parameters-57)
|
|
232
|
+
- [Example usage](#example-usage-57)
|
|
233
|
+
- [isCameraAuthorized()](#iscameraauthorized)
|
|
234
|
+
- [Parameters](#parameters-58)
|
|
235
|
+
- [Example usage](#example-usage-58)
|
|
236
|
+
- [getCameraAuthorizationStatus()](#getcameraauthorizationstatus)
|
|
237
|
+
- [Parameters](#parameters-59)
|
|
238
|
+
- [Example usage](#example-usage-59)
|
|
239
|
+
- [getCameraAuthorizationStatuses()](#getcameraauthorizationstatuses)
|
|
240
|
+
- [Parameters](#parameters-60)
|
|
241
|
+
- [Example usage](#example-usage-60)
|
|
242
|
+
- [requestCameraAuthorization()](#requestcameraauthorization)
|
|
243
|
+
- [Parameters](#parameters-61)
|
|
244
|
+
- [Example usage](#example-usage-61)
|
|
245
|
+
- [isCameraRollAuthorized()](#iscamerarollauthorized)
|
|
246
|
+
- [Parameters](#parameters-62)
|
|
247
|
+
- [Example usage](#example-usage-62)
|
|
248
|
+
- [getCameraRollAuthorizationStatus()](#getcamerarollauthorizationstatus)
|
|
249
|
+
- [Parameters](#parameters-63)
|
|
250
|
+
- [Example usage](#example-usage-63)
|
|
251
|
+
- [requestCameraRollAuthorization()](#requestcamerarollauthorization)
|
|
252
|
+
- [Parameters](#parameters-64)
|
|
253
|
+
- [Example usage](#example-usage-64)
|
|
254
|
+
- [presentLimitedLibraryPicker()](#presentlimitedlibrarypicker)
|
|
255
|
+
- [Parameters](#parameters-65)
|
|
256
|
+
- [Example usage](#example-usage-65)
|
|
257
|
+
- [Notifications module](#notifications-module)
|
|
258
|
+
- [remoteNotificationType constants](#remotenotificationtype-constants)
|
|
259
|
+
- [Example](#example-4)
|
|
260
|
+
- [isRemoteNotificationsEnabled()](#isremotenotificationsenabled)
|
|
261
|
+
- [Parameters](#parameters-66)
|
|
262
|
+
- [Example usage](#example-usage-66)
|
|
263
|
+
- [isRegisteredForRemoteNotifications()](#isregisteredforremotenotifications)
|
|
264
|
+
- [Parameters](#parameters-67)
|
|
265
|
+
- [Example usage](#example-usage-67)
|
|
266
|
+
- [getRemoteNotificationTypes()](#getremotenotificationtypes)
|
|
267
|
+
- [Parameters](#parameters-68)
|
|
268
|
+
- [Example usage](#example-usage-68)
|
|
269
|
+
- [getRemoteNotificationsAuthorizationStatus()](#getremotenotificationsauthorizationstatus)
|
|
270
|
+
- [Parameters](#parameters-69)
|
|
271
|
+
- [Example usage](#example-usage-69)
|
|
272
|
+
- [requestRemoteNotificationsAuthorization()](#requestremotenotificationsauthorization)
|
|
273
|
+
- [Parameters](#parameters-70)
|
|
274
|
+
- [Example usage](#example-usage-70)
|
|
275
|
+
- [switchToNotificationSettings()](#switchtonotificationsettings)
|
|
276
|
+
- [Microphone module](#microphone-module)
|
|
277
|
+
- [isMicrophoneAuthorized()](#ismicrophoneauthorized)
|
|
278
|
+
- [Parameters](#parameters-71)
|
|
279
|
+
- [Example usage](#example-usage-71)
|
|
280
|
+
- [getMicrophoneAuthorizationStatus()](#getmicrophoneauthorizationstatus)
|
|
281
|
+
- [Parameters](#parameters-72)
|
|
282
|
+
- [Example usage](#example-usage-72)
|
|
283
|
+
- [requestMicrophoneAuthorization()](#requestmicrophoneauthorization)
|
|
284
|
+
- [Parameters](#parameters-73)
|
|
285
|
+
- [Example usage](#example-usage-73)
|
|
286
|
+
- [Contacts module](#contacts-module)
|
|
287
|
+
- [isContactsAuthorized()](#iscontactsauthorized)
|
|
288
|
+
- [Parameters](#parameters-74)
|
|
289
|
+
- [Example usage](#example-usage-74)
|
|
290
|
+
- [getContactsAuthorizationStatus()](#getcontactsauthorizationstatus)
|
|
291
|
+
- [Parameters](#parameters-75)
|
|
292
|
+
- [Example usage](#example-usage-75)
|
|
293
|
+
- [requestContactsAuthorization()](#requestcontactsauthorization)
|
|
294
|
+
- [Parameters](#parameters-76)
|
|
295
|
+
- [Example usage](#example-usage-76)
|
|
296
|
+
- [Calendar module](#calendar-module)
|
|
297
|
+
- [isCalendarAuthorized()](#iscalendarauthorized)
|
|
298
|
+
- [Parameters](#parameters-77)
|
|
299
|
+
- [Example usage](#example-usage-77)
|
|
300
|
+
- [getCalendarAuthorizationStatus()](#getcalendarauthorizationstatus)
|
|
301
|
+
- [Parameters](#parameters-78)
|
|
302
|
+
- [Example usage](#example-usage-78)
|
|
303
|
+
- [requestCalendarAuthorization()](#requestcalendarauthorization)
|
|
304
|
+
- [Parameters](#parameters-79)
|
|
305
|
+
- [Example usage](#example-usage-79)
|
|
306
|
+
- [Reminders module](#reminders-module)
|
|
307
|
+
- [isRemindersAuthorized()](#isremindersauthorized)
|
|
308
|
+
- [Parameters](#parameters-80)
|
|
309
|
+
- [Example usage](#example-usage-80)
|
|
310
|
+
- [getRemindersAuthorizationStatus()](#getremindersauthorizationstatus)
|
|
311
|
+
- [Parameters](#parameters-81)
|
|
312
|
+
- [Example usage](#example-usage-81)
|
|
313
|
+
- [requestRemindersAuthorization()](#requestremindersauthorization)
|
|
314
|
+
- [Parameters](#parameters-82)
|
|
315
|
+
- [Example usage](#example-usage-82)
|
|
316
|
+
- [Motion module](#motion-module)
|
|
317
|
+
- [motionStatus constants](#motionstatus-constants)
|
|
318
|
+
- [Example](#example-5)
|
|
319
|
+
- [isMotionAvailable()](#ismotionavailable)
|
|
320
|
+
- [Parameters](#parameters-83)
|
|
321
|
+
- [Example usage](#example-usage-83)
|
|
322
|
+
- [isMotionRequestOutcomeAvailable()](#ismotionrequestoutcomeavailable)
|
|
323
|
+
- [Parameters](#parameters-84)
|
|
324
|
+
- [Example usage](#example-usage-84)
|
|
325
|
+
- [requestMotionAuthorization()](#requestmotionauthorization)
|
|
326
|
+
- [Parameters](#parameters-85)
|
|
327
|
+
- [Example usage](#example-usage-85)
|
|
328
|
+
- [getMotionAuthorizationStatus()](#getmotionauthorizationstatus)
|
|
329
|
+
- [Parameters](#parameters-86)
|
|
330
|
+
- [Example usage](#example-usage-86)
|
|
331
|
+
- [NFC module](#nfc-module)
|
|
332
|
+
- [NFCState constants](#nfcstate-constants)
|
|
333
|
+
- [Values](#values-3)
|
|
334
|
+
- [Example](#example-6)
|
|
335
|
+
- [isNFCPresent()](#isnfcpresent)
|
|
336
|
+
- [Parameters](#parameters-87)
|
|
337
|
+
- [Example usage](#example-usage-87)
|
|
338
|
+
- [isNFCEnabled()](#isnfcenabled)
|
|
339
|
+
- [Parameters](#parameters-88)
|
|
340
|
+
- [Example usage](#example-usage-88)
|
|
341
|
+
- [isNFCAvailable()](#isnfcavailable)
|
|
342
|
+
- [Parameters](#parameters-89)
|
|
343
|
+
- [Example usage](#example-usage-89)
|
|
344
|
+
- [registerNFCStateChangeHandler()](#registernfcstatechangehandler)
|
|
345
|
+
- [Parameters](#parameters-90)
|
|
346
|
+
- [Example usage](#example-usage-90)
|
|
347
|
+
- [switchToNFCSettings()](#switchtonfcsettings)
|
|
348
|
+
- [External storage module](#external-storage-module)
|
|
349
|
+
- [isExternalStorageAuthorized()](#isexternalstorageauthorized)
|
|
350
|
+
- [Parameters](#parameters-91)
|
|
351
|
+
- [Example usage](#example-usage-91)
|
|
352
|
+
- [getExternalStorageAuthorizationStatus()](#getexternalstorageauthorizationstatus)
|
|
353
|
+
- [Parameters](#parameters-92)
|
|
354
|
+
- [Example usage](#example-usage-92)
|
|
355
|
+
- [requestExternalStorageAuthorization()](#requestexternalstorageauthorization)
|
|
356
|
+
- [Parameters](#parameters-93)
|
|
357
|
+
- [Example usage](#example-usage-93)
|
|
358
|
+
- [getExternalSdCardDetails()](#getexternalsdcarddetails)
|
|
359
|
+
- [Parameters](#parameters-94)
|
|
360
|
+
- [Example usage](#example-usage-94)
|
|
361
|
+
- [Platform Notes](#platform-notes)
|
|
362
|
+
- [Android](#android-3)
|
|
363
|
+
- [Android permissions](#android-permissions)
|
|
364
|
+
- [Android runtime permissions](#android-runtime-permissions)
|
|
365
|
+
- ["Dangerous" runtime permissions](#dangerous-runtime-permissions)
|
|
366
|
+
- [Android 11+ runtime permissions](#android-11-runtime-permissions)
|
|
367
|
+
- [Runtime permissions example project](#runtime-permissions-example-project)
|
|
368
|
+
- [Android Camera permissions](#android-camera-permissions)
|
|
369
|
+
- [Android Auto Backup](#android-auto-backup)
|
|
370
|
+
- [iOS](#ios-3)
|
|
371
|
+
- [iOS usage description messages](#ios-usage-description-messages)
|
|
372
|
+
- [Example project](#example-project)
|
|
373
|
+
- [Screenshots](#screenshots)
|
|
374
|
+
- [Android](#android-4)
|
|
375
|
+
- [iOS](#ios-4)
|
|
376
|
+
- [Release notes](#release-notes)
|
|
377
|
+
- [Credits](#credits)
|
|
378
|
+
- [License](#license)
|
|
379
|
+
|
|
380
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
377
381
|
|
|
378
382
|
|
|
379
383
|
# Overview
|
|
@@ -639,17 +643,17 @@ App can never ask for permission again.
|
|
|
639
643
|
The only way around this is to instruct the user to manually change the permission in Settings.
|
|
640
644
|
- `RESTRICTED` - Permission is unavailable and user cannot enable it.
|
|
641
645
|
For example, when parental controls are in effect for the current user.
|
|
642
|
-
- `GRANTED` - User granted access to this permission.
|
|
643
|
-
For location permission, this indicates the user has granted access to the permission "always" (when app is both in foreground and background).
|
|
644
|
-
- `GRANTED_WHEN_IN_USE` - Used only for location permission.
|
|
645
|
-
Indicates the user has granted access to the permission "when in use" (only when the app is in the foreground).
|
|
646
|
-
|
|
647
|
-
Addtionally, for notifications permissions:
|
|
648
|
-
- `PROVISIONAL` - The app is provisionally authorized to post non-interruptive user notifications.
|
|
649
|
-
- `EPHEMERAL` - The app is authorized to schedule or receive notifications for a limited amount of time.
|
|
650
|
-
|
|
651
|
-
For cases where the platform cannot return a definitive answer, the plugin also exposes:
|
|
652
|
-
- `UNKNOWN` (Android and iOS) - Returned when the underlying OS has not yet provided a concrete status (for example, if an iOS Local Network probe timed out). Treat this as a transient state and retry before surfacing a denial to the user.
|
|
646
|
+
- `GRANTED` - User granted access to this permission.
|
|
647
|
+
For location permission, this indicates the user has granted access to the permission "always" (when app is both in foreground and background).
|
|
648
|
+
- `GRANTED_WHEN_IN_USE` - Used only for location permission.
|
|
649
|
+
Indicates the user has granted access to the permission "when in use" (only when the app is in the foreground).
|
|
650
|
+
|
|
651
|
+
Addtionally, for notifications permissions:
|
|
652
|
+
- `PROVISIONAL` - The app is provisionally authorized to post non-interruptive user notifications.
|
|
653
|
+
- `EPHEMERAL` - The app is authorized to schedule or receive notifications for a limited amount of time.
|
|
654
|
+
|
|
655
|
+
For cases where the platform cannot return a definitive answer, the plugin also exposes:
|
|
656
|
+
- `UNKNOWN` (Android and iOS) - Returned when the underlying OS has not yet provided a concrete status (for example, if an iOS Local Network probe timed out). Treat this as a transient state and retry before surfacing a denial to the user.
|
|
653
657
|
|
|
654
658
|
#### Example
|
|
655
659
|
|
|
@@ -1142,6 +1146,95 @@ The function is passed a single `string` parameter containing the error message.
|
|
|
1142
1146
|
console.log(`Current battery level is ${level}%`);
|
|
1143
1147
|
});
|
|
1144
1148
|
|
|
1149
|
+
### isLowPowerModeEnabled()
|
|
1150
|
+
|
|
1151
|
+
Platforms: Android and iOS
|
|
1152
|
+
|
|
1153
|
+
Checks if low power mode is currently enabled on the device.
|
|
1154
|
+
|
|
1155
|
+
cordova.plugins.diagnostic.isLowPowerModeEnabled(successCallback, errorCallback);
|
|
1156
|
+
|
|
1157
|
+
#### Parameters
|
|
1158
|
+
|
|
1159
|
+
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
1160
|
+
The function is passed a single boolean parameter which is TRUE if low power mode is enabled.
|
|
1161
|
+
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
1162
|
+
The function is passed a single string parameter containing the error message.
|
|
1163
|
+
|
|
1164
|
+
#### Example usage
|
|
1165
|
+
|
|
1166
|
+
cordova.plugins.diagnostic.isLowPowerModeEnabled(function(enabled){
|
|
1167
|
+
console.log(`Low power mode is currently ${enabled ? 'enabled' : 'disabled'}`);
|
|
1168
|
+
}, function(error){
|
|
1169
|
+
console.error("The following error occurred: "+error);
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
### onLowPowerModeChange()
|
|
1173
|
+
|
|
1174
|
+
Platforms: Android and iOS
|
|
1175
|
+
|
|
1176
|
+
Registers a callback function to be called whenever the device low power mode status changes.
|
|
1177
|
+
|
|
1178
|
+
cordova.plugins.diagnostic.onLowPowerModeChange(callback);
|
|
1179
|
+
|
|
1180
|
+
#### Parameters
|
|
1181
|
+
|
|
1182
|
+
- {Function} callback - The callback which will be called whenever low power mode changes.
|
|
1183
|
+
The function is passed a single boolean parameter which is TRUE if low power mode is enabled.
|
|
1184
|
+
|
|
1185
|
+
#### Example usage
|
|
1186
|
+
|
|
1187
|
+
cordova.plugins.diagnostic.onLowPowerModeChange(function(enabled){
|
|
1188
|
+
console.log(`Low power mode changed: ${enabled ? 'enabled' : 'disabled'}`);
|
|
1189
|
+
});
|
|
1190
|
+
|
|
1191
|
+
### isIgnoringBatteryOptimizations()
|
|
1192
|
+
|
|
1193
|
+
Platforms: Android
|
|
1194
|
+
|
|
1195
|
+
Checks if the app is currently ignoring battery optimizations.
|
|
1196
|
+
|
|
1197
|
+
cordova.plugins.diagnostic.isIgnoringBatteryOptimizations(successCallback, errorCallback);
|
|
1198
|
+
|
|
1199
|
+
#### Parameters
|
|
1200
|
+
|
|
1201
|
+
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
1202
|
+
The function is passed a single boolean parameter which is TRUE if the app is ignoring battery optimizations.
|
|
1203
|
+
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
1204
|
+
The function is passed a single string parameter containing the error message.
|
|
1205
|
+
|
|
1206
|
+
#### Example usage
|
|
1207
|
+
|
|
1208
|
+
cordova.plugins.diagnostic.isIgnoringBatteryOptimizations(function(enabled){
|
|
1209
|
+
console.log(`Ignoring battery optimizations: ${enabled ? 'yes' : 'no'}`);
|
|
1210
|
+
}, function(error){
|
|
1211
|
+
console.error("The following error occurred: "+error);
|
|
1212
|
+
});
|
|
1213
|
+
|
|
1214
|
+
### requestIgnoreBatteryOptimizations()
|
|
1215
|
+
|
|
1216
|
+
Platforms: Android
|
|
1217
|
+
|
|
1218
|
+
Prompts the user to allow the app to ignore battery optimizations.
|
|
1219
|
+
|
|
1220
|
+
Requires permission `<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />`, which needs to be added to the app's Android manifest.
|
|
1221
|
+
|
|
1222
|
+
cordova.plugins.diagnostic.requestIgnoreBatteryOptimizations(successCallback, errorCallback);
|
|
1223
|
+
|
|
1224
|
+
#### Parameters
|
|
1225
|
+
|
|
1226
|
+
- {Function} successCallback - The callback which will be called when the system request UI is opened.
|
|
1227
|
+
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
1228
|
+
The function is passed a single string parameter containing the error message.
|
|
1229
|
+
|
|
1230
|
+
#### Example usage
|
|
1231
|
+
|
|
1232
|
+
cordova.plugins.diagnostic.requestIgnoreBatteryOptimizations(function(){
|
|
1233
|
+
console.log("Opened battery optimization exemption request");
|
|
1234
|
+
}, function(error){
|
|
1235
|
+
console.error("The following error occurred: "+error);
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1145
1238
|
### isAirplaneModeEnabled()
|
|
1146
1239
|
|
|
1147
1240
|
Platforms: Android
|
|
@@ -1411,6 +1504,7 @@ Platforms: Android & iOS
|
|
|
1411
1504
|
|
|
1412
1505
|
- Defines constants for the various location accuracy authorization states on iOS 14+ and Android 12+.
|
|
1413
1506
|
- See [CLAccuracyAuthorization](https://developer.apple.com/documentation/corelocation/claccuracyauthorization) for iOS 14+ and [approximate location](https://developer.android.com/training/location/permissions#approximate-request) for Android 12+
|
|
1507
|
+
- On iOS, these values can also be passed to `requestLocationAuthorization()` to set the desired [CLLocationAccuracy](https://developer.apple.com/documentation/corelocation/cllocationaccuracy).
|
|
1414
1508
|
|
|
1415
1509
|
```
|
|
1416
1510
|
cordova.plugins.diagnostic.locationAccuracyAuthorization
|
|
@@ -1418,8 +1512,14 @@ cordova.plugins.diagnostic.locationAccuracyAuthorization
|
|
|
1418
1512
|
|
|
1419
1513
|
#### Values
|
|
1420
1514
|
|
|
1421
|
-
- `FULL` - The user authorized the app to access location data with full accuracy.
|
|
1422
|
-
- `REDUCED` - The user authorized the app to access location data with reduced accuracy.
|
|
1515
|
+
- `FULL` - The user authorized the app to access location data with full accuracy. Alias for `BEST`. On iOS, sets `kCLLocationAccuracyBest`.
|
|
1516
|
+
- `REDUCED` - The user authorized the app to access location data with reduced accuracy. On iOS, sets `kCLLocationAccuracyReduced` - approximate location preserving region/city, typically within 1-20km, no GPS hardware engagement.
|
|
1517
|
+
- `BEST` - On iOS, sets `kCLLocationAccuracyBest`. May engage GPS hardware.
|
|
1518
|
+
- `BEST_FOR_NAVIGATION` - On iOS, sets `kCLLocationAccuracyBestForNavigation`. Highest accuracy using additional sensor data.
|
|
1519
|
+
- `NEAREST_TEN_METERS` - On iOS, sets `kCLLocationAccuracyNearestTenMeters`.
|
|
1520
|
+
- `HUNDRED_METERS` - On iOS, sets `kCLLocationAccuracyHundredMeters`.
|
|
1521
|
+
- `KILOMETER` - On iOS, sets `kCLLocationAccuracyKilometer`.
|
|
1522
|
+
- `THREE_KILOMETERS` - On iOS, sets `kCLLocationAccuracyThreeKilometers`.
|
|
1423
1523
|
|
|
1424
1524
|
|
|
1425
1525
|
### isLocationAvailable()
|
|
@@ -1821,6 +1921,16 @@ Notes for Android:
|
|
|
1821
1921
|
- When the plugin is running on/built with Android 12+ / API 31+, you can specify requested location accuracy using the `accuracy` parameter.
|
|
1822
1922
|
- If the build SDK/device version is <= Android 11 / API 30, `FULL` accuracy is implicitly granted.
|
|
1823
1923
|
|
|
1924
|
+
On iOS, the `accuracy` parameter sets the `desiredAccuracy` of the internal `CLLocationManager` used by the plugin:
|
|
1925
|
+
- `FULL` / `BEST` (default) - sets `kCLLocationAccuracyBest`, which may engage GPS hardware.
|
|
1926
|
+
- `REDUCED` - sets `kCLLocationAccuracyReduced`, providing approximate location (typically within 1-20km) without engaging GPS hardware.
|
|
1927
|
+
- `BEST_FOR_NAVIGATION` - sets `kCLLocationAccuracyBestForNavigation`, the highest accuracy using additional sensor data.
|
|
1928
|
+
- `NEAREST_TEN_METERS` - sets `kCLLocationAccuracyNearestTenMeters`.
|
|
1929
|
+
- `HUNDRED_METERS` - sets `kCLLocationAccuracyHundredMeters`.
|
|
1930
|
+
- `KILOMETER` - sets `kCLLocationAccuracyKilometer`.
|
|
1931
|
+
- `THREE_KILOMETERS` - sets `kCLLocationAccuracyThreeKilometers`.
|
|
1932
|
+
- Apps that only need the location permission for non-location purposes (e.g. to access the Wi-Fi SSID) should use `REDUCED` to avoid unnecessary battery drain.
|
|
1933
|
+
|
|
1824
1934
|
```
|
|
1825
1935
|
cordova.plugins.diagnostic.requestLocationAuthorization(successCallback, errorCallback, mode, accuracy);
|
|
1826
1936
|
```
|
|
@@ -1833,9 +1943,10 @@ cordova.plugins.diagnostic.requestLocationAuthorization(successCallback, errorCa
|
|
|
1833
1943
|
- The function is passed a single string parameter containing the error message.
|
|
1834
1944
|
- {String} mode - (optional / iOS & Android >= 10) location authorization mode specified as a [locationAuthorizationMode constant](#locationauthorizationmode-constants).
|
|
1835
1945
|
- If not specified, defaults to `WHEN_IN_USE`.
|
|
1836
|
-
- {String} accuracy - (optional / Android 12+) requested location accuracy as a constant in `cordova.plugins.diagnostic.locationAccuracyAuthorization`
|
|
1946
|
+
- {String} accuracy - (optional / iOS & Android 12+) requested location accuracy as a constant in `cordova.plugins.diagnostic.locationAccuracyAuthorization`
|
|
1837
1947
|
- If not specified, defaults to `cordova.plugins.diagnostic.locationAccuracyAuthorization.FULL`
|
|
1838
|
-
- On
|
|
1948
|
+
- On iOS, sets the CLLocationManager's desiredAccuracy - see [locationAccuracyAuthorization constants](#locationaccuracyauthorization-constants) for the full list of available values.
|
|
1949
|
+
- On Android <12, has no effect.
|
|
1839
1950
|
|
|
1840
1951
|
#### Example usage
|
|
1841
1952
|
|
|
@@ -2458,80 +2569,80 @@ The function is passed a single string parameter containing the error message.
|
|
|
2458
2569
|
|
|
2459
2570
|
Platforms: iOS
|
|
2460
2571
|
|
|
2461
|
-
Checks if the app is authorised to access devices on the local network (iOS 14+).
|
|
2462
|
-
On iOS versions prior to 14 this will always return TRUE as no local network authorization is required.
|
|
2463
|
-
An optional third argument allows you to override the fallback timeout (defaults to 2 seconds) by passing `{ timeoutMs: <number> }`.
|
|
2572
|
+
Checks if the app is authorised to access devices on the local network (iOS 14+).
|
|
2573
|
+
On iOS versions prior to 14 this will always return TRUE as no local network authorization is required.
|
|
2574
|
+
An optional third argument allows you to override the fallback timeout (defaults to 2 seconds) by passing `{ timeoutMs: <number> }`.
|
|
2464
2575
|
|
|
2465
2576
|
cordova.plugins.diagnostic.isLocalNetworkAuthorized(successCallback, errorCallback);
|
|
2466
2577
|
|
|
2467
|
-
#### Parameters
|
|
2468
|
-
|
|
2469
|
-
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
2470
|
-
The function is passed a single boolean parameter which is TRUE if the app is authorised to use the Local Network.
|
|
2471
|
-
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
2472
|
-
The function is passed a single string parameter containing the error message.
|
|
2473
|
-
- {Object} [options] - Optional timeout control object. Provide `timeoutMs` (milliseconds) to override the default 2000 ms timeout.
|
|
2578
|
+
#### Parameters
|
|
2579
|
+
|
|
2580
|
+
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
2581
|
+
The function is passed a single boolean parameter which is TRUE if the app is authorised to use the Local Network.
|
|
2582
|
+
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
2583
|
+
The function is passed a single string parameter containing the error message.
|
|
2584
|
+
- {Object} [options] - Optional timeout control object. Provide `timeoutMs` (milliseconds) to override the default 2000 ms timeout.
|
|
2474
2585
|
|
|
2475
2586
|
|
|
2476
2587
|
#### Example usage
|
|
2477
2588
|
|
|
2478
|
-
cordova.plugins.diagnostic.isLocalNetworkAuthorized(function(authorized){
|
|
2479
|
-
console.log("Local Network is " + (authorized ? "authorized" : "unauthorised"));
|
|
2480
|
-
}, function(error){
|
|
2481
|
-
console.error("The following error occurred: "+error);
|
|
2482
|
-
});
|
|
2483
|
-
|
|
2484
|
-
To wait longer before treating a slow response as indeterminate:
|
|
2485
|
-
|
|
2486
|
-
```
|
|
2487
|
-
cordova.plugins.diagnostic.isLocalNetworkAuthorized(
|
|
2488
|
-
function(authorized){
|
|
2489
|
-
console.log("Local Network authorized? " + authorized);
|
|
2490
|
-
},
|
|
2491
|
-
console.error,
|
|
2492
|
-
{ timeoutMs: 8000 }
|
|
2493
|
-
);
|
|
2494
|
-
```
|
|
2589
|
+
cordova.plugins.diagnostic.isLocalNetworkAuthorized(function(authorized){
|
|
2590
|
+
console.log("Local Network is " + (authorized ? "authorized" : "unauthorised"));
|
|
2591
|
+
}, function(error){
|
|
2592
|
+
console.error("The following error occurred: "+error);
|
|
2593
|
+
});
|
|
2594
|
+
|
|
2595
|
+
To wait longer before treating a slow response as indeterminate:
|
|
2596
|
+
|
|
2597
|
+
```
|
|
2598
|
+
cordova.plugins.diagnostic.isLocalNetworkAuthorized(
|
|
2599
|
+
function(authorized){
|
|
2600
|
+
console.log("Local Network authorized? " + authorized);
|
|
2601
|
+
},
|
|
2602
|
+
console.error,
|
|
2603
|
+
{ timeoutMs: 8000 }
|
|
2604
|
+
);
|
|
2605
|
+
```
|
|
2495
2606
|
|
|
2496
2607
|
### getLocalNetworkAuthorizationStatus()
|
|
2497
2608
|
|
|
2498
2609
|
Platforms: iOS
|
|
2499
2610
|
|
|
2500
|
-
Returns the app's Local Network authorization status.
|
|
2501
|
-
On iOS 14+ this returns one of the values in `cordova.plugins.diagnostic.permissionStatus`: `NOT_REQUESTED`, `GRANTED`, `DENIED_ALWAYS`, `UNKNOWN`.
|
|
2502
|
-
`UNKNOWN` indicates that iOS did not return a definitive answer before the timeout elapsed, so the app can retry before warning the user.
|
|
2503
|
-
On iOS versions prior to 14 this will always return `GRANTED` as no authorization is required.
|
|
2611
|
+
Returns the app's Local Network authorization status.
|
|
2612
|
+
On iOS 14+ this returns one of the values in `cordova.plugins.diagnostic.permissionStatus`: `NOT_REQUESTED`, `GRANTED`, `DENIED_ALWAYS`, `UNKNOWN`.
|
|
2613
|
+
`UNKNOWN` indicates that iOS did not return a definitive answer before the timeout elapsed, so the app can retry before warning the user.
|
|
2614
|
+
On iOS versions prior to 14 this will always return `GRANTED` as no authorization is required.
|
|
2504
2615
|
|
|
2505
2616
|
cordova.plugins.diagnostic.getLocalNetworkAuthorizationStatus(successCallback, errorCallback);
|
|
2506
2617
|
|
|
2507
2618
|
#### Parameters
|
|
2508
2619
|
|
|
2509
|
-
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
2510
|
-
The function is passed a single string parameter which is one of the values in `cordova.plugins.diagnostic.permissionStatus`:
|
|
2511
|
-
`NOT_REQUESTED`, `GRANTED`, `DENIED_ALWAYS`, `UNKNOWN`.
|
|
2512
|
-
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
2513
|
-
The function is passed a single string parameter containing the error message.
|
|
2514
|
-
- {Object} [options] - Optional timeout override (defaults to 2 seconds). Provide `timeoutMs` (milliseconds) to customize the fallback duration.
|
|
2620
|
+
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
2621
|
+
The function is passed a single string parameter which is one of the values in `cordova.plugins.diagnostic.permissionStatus`:
|
|
2622
|
+
`NOT_REQUESTED`, `GRANTED`, `DENIED_ALWAYS`, `UNKNOWN`.
|
|
2623
|
+
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
2624
|
+
The function is passed a single string parameter containing the error message.
|
|
2625
|
+
- {Object} [options] - Optional timeout override (defaults to 2 seconds). Provide `timeoutMs` (milliseconds) to customize the fallback duration.
|
|
2515
2626
|
|
|
2516
2627
|
|
|
2517
2628
|
#### Example usage
|
|
2518
2629
|
|
|
2519
2630
|
cordova.plugins.diagnostic.getLocalNetworkAuthorizationStatus(function(status){
|
|
2520
|
-
switch(status){
|
|
2521
|
-
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
|
2522
|
-
console.log("Local Network permission not requested");
|
|
2523
|
-
break;
|
|
2524
|
-
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
|
2525
|
-
console.log("Local Network permission denied");
|
|
2526
|
-
break;
|
|
2527
|
-
case cordova.plugins.diagnostic.permissionStatus.UNKNOWN:
|
|
2528
|
-
console.log("Local Network permission could not be determined (retry recommended)");
|
|
2529
|
-
break;
|
|
2530
|
-
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
|
2531
|
-
console.log("Local Network permission granted");
|
|
2532
|
-
break;
|
|
2533
|
-
}
|
|
2534
|
-
}, function(error){
|
|
2631
|
+
switch(status){
|
|
2632
|
+
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
|
2633
|
+
console.log("Local Network permission not requested");
|
|
2634
|
+
break;
|
|
2635
|
+
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
|
2636
|
+
console.log("Local Network permission denied");
|
|
2637
|
+
break;
|
|
2638
|
+
case cordova.plugins.diagnostic.permissionStatus.UNKNOWN:
|
|
2639
|
+
console.log("Local Network permission could not be determined (retry recommended)");
|
|
2640
|
+
break;
|
|
2641
|
+
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
|
2642
|
+
console.log("Local Network permission granted");
|
|
2643
|
+
break;
|
|
2644
|
+
}
|
|
2645
|
+
}, function(error){
|
|
2535
2646
|
console.error("The following error occurred: "+error);
|
|
2536
2647
|
});
|
|
2537
2648
|
|
|
@@ -2539,34 +2650,34 @@ On iOS versions prior to 14 this will always return `GRANTED` as no authorizatio
|
|
|
2539
2650
|
|
|
2540
2651
|
Platforms: iOS
|
|
2541
2652
|
|
|
2542
|
-
Requests the user to authorise the app to access devices on the local network (iOS 14+).
|
|
2543
|
-
On iOS versions prior to 14 this does nothing and will return success as no authorization is required.
|
|
2544
|
-
May return `UNKNOWN` if iOS does not respond before the native APIs time out, allowing the app to retry.
|
|
2653
|
+
Requests the user to authorise the app to access devices on the local network (iOS 14+).
|
|
2654
|
+
On iOS versions prior to 14 this does nothing and will return success as no authorization is required.
|
|
2655
|
+
May return `UNKNOWN` if iOS does not respond before the native APIs time out, allowing the app to retry.
|
|
2545
2656
|
|
|
2546
2657
|
cordova.plugins.diagnostic.requestLocalNetworkAuthorization(successCallback, errorCallback);
|
|
2547
2658
|
|
|
2548
2659
|
#### Parameters
|
|
2549
2660
|
|
|
2550
|
-
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
2551
|
-
The function is passed a single string parameter which is one of the values in `cordova.plugins.diagnostic.permissionStatus`:
|
|
2552
|
-
`NOT_REQUESTED`, `GRANTED`, `DENIED_ALWAYS`, `UNKNOWN`.
|
|
2661
|
+
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
2662
|
+
The function is passed a single string parameter which is one of the values in `cordova.plugins.diagnostic.permissionStatus`:
|
|
2663
|
+
`NOT_REQUESTED`, `GRANTED`, `DENIED_ALWAYS`, `UNKNOWN`.
|
|
2553
2664
|
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
2554
2665
|
The function is passed a single string parameter containing the error message.
|
|
2555
2666
|
|
|
2556
2667
|
|
|
2557
2668
|
#### Example usage
|
|
2558
2669
|
|
|
2559
|
-
cordova.plugins.diagnostic.requestLocalNetworkAuthorization(function(status){
|
|
2560
|
-
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
|
2561
|
-
console.log("Local Network access granted");
|
|
2562
|
-
}else if(status === cordova.plugins.diagnostic.permissionStatus.UNKNOWN){
|
|
2563
|
-
console.log("Local Network status could not be determined, retrying may succeed");
|
|
2564
|
-
}else{
|
|
2565
|
-
console.log("Local Network access not granted: " + status);
|
|
2566
|
-
}
|
|
2567
|
-
}, function(error){
|
|
2568
|
-
console.error("The following error occurred: "+error);
|
|
2569
|
-
});
|
|
2670
|
+
cordova.plugins.diagnostic.requestLocalNetworkAuthorization(function(status){
|
|
2671
|
+
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
|
2672
|
+
console.log("Local Network access granted");
|
|
2673
|
+
}else if(status === cordova.plugins.diagnostic.permissionStatus.UNKNOWN){
|
|
2674
|
+
console.log("Local Network status could not be determined, retrying may succeed");
|
|
2675
|
+
}else{
|
|
2676
|
+
console.log("Local Network access not granted: " + status);
|
|
2677
|
+
}
|
|
2678
|
+
}, function(error){
|
|
2679
|
+
console.error("The following error occurred: "+error);
|
|
2680
|
+
});
|
|
2570
2681
|
|
|
2571
2682
|
### setWifiState()
|
|
2572
2683
|
|