cordova.plugins.diagnostic 7.0.0 → 7.1.1
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 +15 -1
- package/README.md +248 -111
- package/cordova.plugins.diagnostic.d.ts +49 -0
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/Diagnostic.java +65 -0
- package/src/ios/Diagnostic.h +3 -0
- package/src/ios/Diagnostic.m +64 -0
- package/src/ios/Diagnostic_Bluetooth.m +10 -13
- package/www/android/diagnostic.js +55 -0
- package/www/ios/diagnostic.camera.js +3 -5
- package/www/ios/diagnostic.js +55 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
**v7.
|
|
3
|
+
**v7.1.1**
|
|
4
|
+
* (Android, iOS) feat: Add `isMobileDataEnabled()` to core module.
|
|
5
|
+
* Based on PR [#478](https://github.com/dpa99c/cordova-diagnostic-plugin/pull/478)
|
|
6
|
+
* (iOS) bugfix: Only allow Bluetooth permission request if not already requested.
|
|
7
|
+
* Resolves [#477](https://github.com/dpa99c/cordova-diagnostic-plugin/issues/477).
|
|
8
|
+
* (iOS) bugfix: Resolve the correct authorization status after requesting camera roll authorization and granting LIMITED access.
|
|
9
|
+
* Resolves [#476](https://github.com/dpa99c/cordova-diagnostic-plugin/issues/476).
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
**v7.1.0**
|
|
13
|
+
* (Android, iOS) feat: add support to fetch device OS and build SDK details
|
|
4
14
|
|
|
15
|
+
|
|
16
|
+
**v7.0.0**
|
|
17
|
+
* (Android) BREAKING chore: Remove deprecated aliases `cordova.plugins.diagnostic.runtimePermission` and `cordova.plugins.diagnostic.runtimePermissionStatus`
|
|
18
|
+
- Use `cordova.plugins.diagnostic.permission` and `cordova.plugins.diagnostic.permissionStatus` instead.
|
|
5
19
|
* (iOS) feat: Add support for Photo Library access levels on iOS 14+
|
|
6
20
|
* Resolves [#473](https://github.com/dpa99c/cordova-diagnostic-plugin/issues/473).
|
|
7
21
|
* Add support to show Limited-Library Selection UI for Photo Roll in iOS 14+
|
package/README.md
CHANGED
|
@@ -42,6 +42,9 @@ Cordova diagnostic plugin [](#enabledebug)
|
|
43
43
|
- [getCurrentBatteryLevel()](#getcurrentbatterylevel)
|
|
44
44
|
- [isAirplaneModeEnabled()](#isairplanemodeenabled)
|
|
45
|
+
- [isMobileDataEnabled()](#ismobiledataenabled)
|
|
46
|
+
- [getDeviceOSVersion()](#getdeviceosversion)
|
|
47
|
+
- [getBuildOSVersion()](#getbuildosversion)
|
|
45
48
|
- [Location module](#location-module)
|
|
46
49
|
- [locationMode constants](#locationmode-constants)
|
|
47
50
|
- [locationAuthorizationMode constants](#locationauthorizationmode-constants)
|
|
@@ -268,20 +271,20 @@ Before [opening a bug issue](https://github.com/dpa99c/cordova-diagnostic-plugin
|
|
|
268
271
|
- *DO NOT* open issues related to the [Ionic Typescript wrapper for this plugin](https://github.com/ionic-team/ionic-native/blob/master/src/%40ionic-native/plugins/diagnostic/index.ts)
|
|
269
272
|
- This is owned/maintained by [Ionic](https://github.com/ionic-team) and is not part of this plugin
|
|
270
273
|
- Please raise such issues/PRs against [Ionic Native](https://github.com/ionic-team/ionic-native/) instead.
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
- To verify an if an issue is caused by this plugin or its Typescript wrapper, please re-test using the vanilla Javascript plugin interface (without the Ionic Native wrapper).
|
|
275
|
+
- Any issue opened here which is obviously an Ionic Typescript wrapper issue will be closed immediately.
|
|
273
276
|
- Read the above documentation thoroughly
|
|
274
277
|
- Check the [CHANGELOG](https://github.com/dpa99c/cordova-diagnostic-plugin/blob/master/CHANGELOG.md) for any breaking changes that may be causing your issue.
|
|
275
278
|
- Check a similar issue (open or closed) does not already exist against this plugin.
|
|
276
|
-
|
|
279
|
+
- Duplicates or near-duplicates will be closed immediately.
|
|
277
280
|
- When [creating a new issue](https://github.com/dpa99c/cordova-diagnostic-plugin/issues/new/choose)
|
|
278
281
|
- Choose the "Bug report" template
|
|
279
282
|
- Fill out the relevant sections of the template and delete irrelevant sections
|
|
280
283
|
- *WARNING:* Failure to complete the issue template will result in the issue being closed immediately.
|
|
281
284
|
- Reproduce the issue using the [example project](https://github.com/dpa99c/cordova-diagnostic-plugin-example)
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
+
- This will eliminate bugs in your code or conflicts with other code as possible causes of the issue
|
|
286
|
+
- This will also validate your development environment using a known working codebase
|
|
287
|
+
- If reproducing the issue using the example project is not possible, create an isolated test project that you are able to share
|
|
285
288
|
- Include full verbose console output when reporting build issues
|
|
286
289
|
- If the full console output is too large to insert directly into the Github issue, then post it on an external site such as [Pastebin](https://pastebin.com/) and link to it from the issue
|
|
287
290
|
- Often the details of an error causing a build failure is hidden away when building with the CLI
|
|
@@ -774,7 +777,7 @@ Platforms: Android and iOS
|
|
|
774
777
|
|
|
775
778
|
Defines constants for the various CPU architectures of the current hardware returned by [getArchitecture()](#getarchitecture).
|
|
776
779
|
|
|
777
|
-
|
|
780
|
+
cordova.plugins.diagnostic.cpuArchitecture
|
|
778
781
|
|
|
779
782
|
#### Android
|
|
780
783
|
|
|
@@ -871,8 +874,9 @@ Enables debug mode, which logs native debug messages to the native and JS consol
|
|
|
871
874
|
- For iOS, log messages will appear in the native Xcode console output and in the JS console if Safari Web Inspector is connected to the app Webview.
|
|
872
875
|
- Debug mode is initially disabled on plugin initialisation.
|
|
873
876
|
|
|
874
|
-
|
|
875
|
-
|
|
877
|
+
```
|
|
878
|
+
cordova.plugins.diagnostic.enableDebug(successCallback);
|
|
879
|
+
```
|
|
876
880
|
|
|
877
881
|
#### Parameters
|
|
878
882
|
|
|
@@ -929,6 +933,95 @@ The function is passed a single string parameter containing the error message.
|
|
|
929
933
|
console.log(`Airplane mode is currently ${enabled ? 'enabled' : 'disabled'}%`);
|
|
930
934
|
});
|
|
931
935
|
|
|
936
|
+
|
|
937
|
+
=======
|
|
938
|
+
|
|
939
|
+
### isMobileDataEnabled()
|
|
940
|
+
|
|
941
|
+
Platforms: Android and iOS
|
|
942
|
+
|
|
943
|
+
Checks if mobile (cellular) data is currently enabled on the device.
|
|
944
|
+
|
|
945
|
+
On Android this requires permission `<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />`
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
cordova.plugins.diagnostic.isMobileDataEnabled(successCallback, errorCallback);
|
|
949
|
+
|
|
950
|
+
#### Parameters
|
|
951
|
+
|
|
952
|
+
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
953
|
+
The function is passed a single boolean parameter which is TRUE if mobile data is enabled.
|
|
954
|
+
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
955
|
+
The function is passed a single string parameter containing the error message.
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
#### Example usage
|
|
959
|
+
|
|
960
|
+
cordova.plugins.diagnostic.isMobileDataEnabled(function(enabled){
|
|
961
|
+
console.log(`Mobile data is currently ${enabled ? 'enabled' : 'disabled'}%`);
|
|
962
|
+
});
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
### getDeviceOSVersion()
|
|
966
|
+
|
|
967
|
+
Platforms: Android and iOS
|
|
968
|
+
|
|
969
|
+
Returns details of the OS of the device on which the app is currently running.
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
cordova.plugins.diagnostic.getDeviceOSVersion(successCallback, errorCallback);
|
|
973
|
+
|
|
974
|
+
#### Parameters
|
|
975
|
+
|
|
976
|
+
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
977
|
+
The function is passed a single object parameter with the following fields:
|
|
978
|
+
- {string} version - version string of the OS e.g. "11.0"
|
|
979
|
+
- {integer} apiLevel - API level of the OS e.g. 30 on Android / 16000 on iOS
|
|
980
|
+
- {string} apiName - code name for API level e.g. "FROYO" on Android / "11.0" on iOS
|
|
981
|
+
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
982
|
+
The function is passed a single string parameter containing the error message.
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
#### Example usage
|
|
986
|
+
|
|
987
|
+
cordova.plugins.diagnostic.getDeviceOSVersion(function(details){
|
|
988
|
+
console.log(`Version: ${details.version}%`); // "13.0"
|
|
989
|
+
console.log(`API level: ${details.apiLevel}%`); // 33
|
|
990
|
+
console.log(`API name: ${details.apiName}%`); // "TIRAMISU"
|
|
991
|
+
});
|
|
992
|
+
|
|
993
|
+
### getBuildOSVersion()
|
|
994
|
+
|
|
995
|
+
Platforms: Android and iOS
|
|
996
|
+
|
|
997
|
+
Returns details of the SDK levels used to build the app.
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
cordova.plugins.diagnostic.getBuildOSVersion(successCallback, errorCallback);
|
|
1001
|
+
|
|
1002
|
+
#### Parameters
|
|
1003
|
+
|
|
1004
|
+
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
1005
|
+
The function is passed a single object parameter with the following fields:
|
|
1006
|
+
- {integer} targetApiLevel - API level of the target SDK (used to build the app) e.g. 30 on Android / 16000 on iOS
|
|
1007
|
+
- {string} targetApiName - code name for API level of the target SDK e.g. "FROYO" on Android / "11.0" on iOS
|
|
1008
|
+
- {integer} minApiLevel - API level of the minimum SDK (lowest on which the app can be installed) e.g. 30 on Android / 16000 on iOS
|
|
1009
|
+
- {string} minApiName - code name for API level of the minimum SDK e.g. "FROYO" on Android / "11.0" on iOS
|
|
1010
|
+
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
1011
|
+
The function is passed a single string parameter containing the error message.
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
#### Example usage
|
|
1015
|
+
|
|
1016
|
+
cordova.plugins.diagnostic.getBuildOSVersion(function(details){
|
|
1017
|
+
console.log(`Target API level: ${details.targetApiLevel}%`); // 33
|
|
1018
|
+
console.log(`Target API name: ${details.targetApiLevel}%`); // "TIRAMISU"
|
|
1019
|
+
console.log(`Minimum API level: ${details.targetApiLevel}%`); // 21
|
|
1020
|
+
console.log(`Target API name: ${details.targetApiLevel}%`); // "LOLLIPOP"
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
932
1025
|
## Location module
|
|
933
1026
|
|
|
934
1027
|
Purpose: Location/GPS functionality
|
|
@@ -1003,8 +1096,9 @@ Platforms: Android & iOS
|
|
|
1003
1096
|
- Defines constants for the various location accuracy authorization states on iOS 14+ and Android 12+.
|
|
1004
1097
|
- 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+
|
|
1005
1098
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1099
|
+
```
|
|
1100
|
+
cordova.plugins.diagnostic.locationAccuracyAuthorization
|
|
1101
|
+
```
|
|
1008
1102
|
|
|
1009
1103
|
#### Values
|
|
1010
1104
|
|
|
@@ -1108,8 +1202,9 @@ Returns true if Location mode is enabled and is set to either:
|
|
|
1108
1202
|
- Device only = GPS hardware only (high accuracy)
|
|
1109
1203
|
- High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
|
1110
1204
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1205
|
+
```
|
|
1206
|
+
cordova.plugins.diagnostic.isGpsLocationEnabled(successCallback, errorCallback);
|
|
1207
|
+
```
|
|
1113
1208
|
|
|
1114
1209
|
#### Parameters
|
|
1115
1210
|
|
|
@@ -1163,8 +1258,9 @@ Returns true if Location mode is enabled and is set to either:
|
|
|
1163
1258
|
- Battery saving = network triangulation and Wifi network IDs (low accuracy)
|
|
1164
1259
|
- High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
|
1165
1260
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1261
|
+
```
|
|
1262
|
+
cordova.plugins.diagnostic.isNetworkLocationEnabled(successCallback, errorCallback);
|
|
1263
|
+
```
|
|
1168
1264
|
|
|
1169
1265
|
#### Parameters
|
|
1170
1266
|
|
|
@@ -1232,7 +1328,9 @@ Notes for Android:
|
|
|
1232
1328
|
- This is intended for Android 6 / API 23 and above.
|
|
1233
1329
|
Calling on Android 5.1 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
|
1234
1330
|
|
|
1235
|
-
|
|
1331
|
+
```
|
|
1332
|
+
cordova.plugins.diagnostic.isLocationAuthorized(successCallback, errorCallback);
|
|
1333
|
+
```
|
|
1236
1334
|
|
|
1237
1335
|
#### Parameters
|
|
1238
1336
|
|
|
@@ -1258,13 +1356,14 @@ Platforms: Android and iOS
|
|
|
1258
1356
|
|
|
1259
1357
|
Returns the location authorization status for the application.
|
|
1260
1358
|
|
|
1261
|
-
Notes for Android:
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1359
|
+
Notes for Android:
|
|
1360
|
+
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
|
1361
|
+
- This is the combined location status for both `COARSE` and `FINE` permissions.
|
|
1362
|
+
- On Android 10+/API 29+, if `COARSE` or `FINE` permission is `GRANTED` but `BACKGROUND_LOCATION` permission is not `GRANTED`, will return `GRANTED_WHEN_IN_USE`.
|
|
1265
1363
|
|
|
1266
|
-
|
|
1267
|
-
|
|
1364
|
+
```
|
|
1365
|
+
cordova.plugins.diagnostic.getLocationAuthorizationStatus(successCallback, errorCallback);
|
|
1366
|
+
```
|
|
1268
1367
|
|
|
1269
1368
|
#### Parameters
|
|
1270
1369
|
|
|
@@ -1318,19 +1417,19 @@ The function is passed a single string parameter containing the error message.
|
|
|
1318
1417
|
}, function(error){
|
|
1319
1418
|
console.error(error);
|
|
1320
1419
|
});
|
|
1321
|
-
|
|
1420
|
+
|
|
1322
1421
|
### getLocationAuthorizationStatuses()
|
|
1323
1422
|
|
|
1324
1423
|
Platforms: Android
|
|
1325
1424
|
|
|
1326
1425
|
Returns the individual location authorization status for each type of location access (`FINE`, `COARSE` and `BACKGROUND`).
|
|
1327
1426
|
|
|
1328
|
-
|
|
1329
|
-
|
|
1427
|
+
- Calling on Android 5.1 / API 22 and below will always return `GRANTED` status as permissions are already granted at installation time.
|
|
1428
|
+
- Calling on Android 9 / API 28 and below, `BACKGROUND_LOCATION` permission is always implicitly `GRANTED`.
|
|
1330
1429
|
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1430
|
+
```
|
|
1431
|
+
cordova.plugins.diagnostic.getLocationAuthorizationStatuses(successCallback, errorCallback);
|
|
1432
|
+
```
|
|
1334
1433
|
|
|
1335
1434
|
#### Parameters
|
|
1336
1435
|
|
|
@@ -1339,22 +1438,23 @@ The function is passed a single array parameter which contains a list indicating
|
|
|
1339
1438
|
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
1340
1439
|
The function is passed a single string parameter containing the error message.
|
|
1341
1440
|
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1441
|
+
```
|
|
1442
|
+
cordova.plugins.diagnostic.getLocationAuthorizationStatuses(function(statuses){
|
|
1443
|
+
console.log("FINE permission status: " + statuses[cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION])
|
|
1444
|
+
console.log("COARSE permission status: " + statuses[cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION])
|
|
1445
|
+
console.log("BACKGROUND permission status: " + statuses[cordova.plugins.diagnostic.permission.ACCESS_BACKGROUND_LOCATION])
|
|
1446
|
+
}, function(error){
|
|
1447
|
+
console.error(error);
|
|
1448
|
+
});
|
|
1449
|
+
```
|
|
1350
1450
|
|
|
1351
1451
|
### requestLocationAuthorization()
|
|
1352
1452
|
|
|
1353
|
-
|
|
1453
|
+
Platforms: Android and iOS
|
|
1354
1454
|
|
|
1355
|
-
|
|
1455
|
+
Requests location authorization for the application.
|
|
1356
1456
|
|
|
1357
|
-
|
|
1457
|
+
Notes for iOS:
|
|
1358
1458
|
|
|
1359
1459
|
- Authorization can be requested to use location either "when in use" (only in foreground) or "always" (foreground and background).
|
|
1360
1460
|
- This should only be called if authorization status is `NOT_REQUESTED` - calling it when in any other state will have no effect.
|
|
@@ -1370,7 +1470,7 @@ this plugin provides default messages, but you should override them with your sp
|
|
|
1370
1470
|
| WHEN_IN_USE | Allow While Using App | `kCLAuthorizationStatusAuthorizedWhenInUse` | `GRANTED_WHEN_IN_USE` |
|
|
1371
1471
|
| WHEN_IN_USE | Allow Once | `kCLAuthorizationStatusAuthorizedWhenInUse` | `GRANTED_WHEN_IN_USE` |
|
|
1372
1472
|
|
|
1373
|
-
|
|
1473
|
+
Notes for Android:
|
|
1374
1474
|
|
|
1375
1475
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will have no effect as the permissions are already granted at installation time.
|
|
1376
1476
|
- For Android 11+ / API 30+), make an initial request with `mode` set to `cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS` will NOT present the user with a dialog at all and immediately returns a `DENIED` result.
|
|
@@ -1381,12 +1481,14 @@ this plugin provides default messages, but you should override them with your sp
|
|
|
1381
1481
|
- When the plugin is running on/built with Android 12+ / API 31+, you can specify requested location accuracy using the `accuracy` parameter.
|
|
1382
1482
|
- If the build SDK/device version is <= Android 11 / API 30, `FULL` accuracy is implicitly granted.
|
|
1383
1483
|
|
|
1384
|
-
|
|
1484
|
+
```
|
|
1485
|
+
cordova.plugins.diagnostic.requestLocationAuthorization(successCallback, errorCallback, mode, accuracy);
|
|
1486
|
+
```
|
|
1385
1487
|
|
|
1386
1488
|
#### Parameters
|
|
1387
1489
|
|
|
1388
1490
|
- {Function} successCallback - Invoked in response to the user's choice in the permission dialog.
|
|
1389
|
-
|
|
1491
|
+
- It is passed a single string parameter which defines the [resulting authorisation status](#runtime-permission-statuses).
|
|
1390
1492
|
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
1391
1493
|
- The function is passed a single string parameter containing the error message.
|
|
1392
1494
|
- {String} mode - (optional / iOS & Android >= 10) location authorization mode specified as a [locationAuthorizationMode constant](#locationauthorizationmode-constants).
|
|
@@ -1454,7 +1556,7 @@ On iOS, the function is passed a single string parameter indicating the new loca
|
|
|
1454
1556
|
|
|
1455
1557
|
### getLocationAccuracyAuthorization()
|
|
1456
1558
|
|
|
1457
|
-
Platforms: Android & iOS
|
|
1559
|
+
Platforms: Android & iOS
|
|
1458
1560
|
|
|
1459
1561
|
Returns the location accuracy authorization for the application on iOS 14+ and Android 12+.
|
|
1460
1562
|
Note: calling on iOS <14 or Android <12 will always return `cordova.plugins.diagnostic.locationAccuracyAuthorization.FULL`.
|
|
@@ -1510,8 +1612,9 @@ You'll need to add this entry using a `<config-file>` block in your `config.xml`
|
|
|
1510
1612
|
- Should only be called if location authorization has been granted, otherwise `errorCallback` will be invoked.
|
|
1511
1613
|
- See [requestTemporaryFullAccuracyAuthorizationWithPurposeKey](https://developer.apple.com/documentation/corelocation/cllocationmanager/3600217-requesttemporaryfullaccuracyauth?language=objc).
|
|
1512
1614
|
|
|
1513
|
-
|
|
1514
|
-
|
|
1615
|
+
```
|
|
1616
|
+
cordova.plugins.diagnostic.requestTemporaryFullAccuracyAuthorization(purpose, successCallback, errorCallback);
|
|
1617
|
+
```
|
|
1515
1618
|
|
|
1516
1619
|
#### Parameters
|
|
1517
1620
|
|
|
@@ -1595,7 +1698,7 @@ Platforms: Android and iOS
|
|
|
1595
1698
|
|
|
1596
1699
|
Defines constants for the various Bluetooth hardware states
|
|
1597
1700
|
|
|
1598
|
-
|
|
1701
|
+
cordova.plugins.diagnostic.bluetoothState
|
|
1599
1702
|
|
|
1600
1703
|
#### Android
|
|
1601
1704
|
|
|
@@ -1824,10 +1927,11 @@ Android:
|
|
|
1824
1927
|
|
|
1825
1928
|
iOS:
|
|
1826
1929
|
- On iOS 13+ returns the Bluetooth authorization status of application
|
|
1827
|
-
- On iOS 12 and below, always return GRANTED as Bluetooth permission is not required.
|
|
1930
|
+
- On iOS 12 and below, always return GRANTED as Bluetooth permission is not required.
|
|
1828
1931
|
|
|
1829
|
-
|
|
1830
|
-
|
|
1932
|
+
```
|
|
1933
|
+
cordova.plugins.diagnostic.getBluetoothAuthorizationStatus(successCallback, errorCallback);
|
|
1934
|
+
```
|
|
1831
1935
|
|
|
1832
1936
|
#### Parameters
|
|
1833
1937
|
|
|
@@ -1844,7 +1948,7 @@ iOS:
|
|
|
1844
1948
|
}
|
|
1845
1949
|
}, function(error){
|
|
1846
1950
|
console.error(error);
|
|
1847
|
-
});
|
|
1951
|
+
});
|
|
1848
1952
|
|
|
1849
1953
|
### getBluetoothAuthorizationStatuses()
|
|
1850
1954
|
|
|
@@ -1853,7 +1957,9 @@ Platforms: Android
|
|
|
1853
1957
|
- Returns the individual authorization status for each Bluetooth run-time permission on Android 12+ / API 31+
|
|
1854
1958
|
- On Android 11 / API 30 and below, all will be returned as GRANTED if the manifest has BLUETOOTH since they are implicitly granted at build-time.
|
|
1855
1959
|
|
|
1856
|
-
|
|
1960
|
+
```
|
|
1961
|
+
cordova.plugins.diagnostic.getBluetoothAuthorizationStatuses(successCallback, errorCallback);
|
|
1962
|
+
```
|
|
1857
1963
|
|
|
1858
1964
|
#### Parameters
|
|
1859
1965
|
|
|
@@ -1887,7 +1993,9 @@ Notes for iOS:
|
|
|
1887
1993
|
- When calling this function, the message contained in the `NSBluetoothPeripheralUsageDescription` .plist key is displayed to the user;
|
|
1888
1994
|
this plugin provides a default message, but you should override this with your specific reason for requesting access - see the [iOS usage description messages](#ios-usage-description-messages) section for how to customise it.
|
|
1889
1995
|
|
|
1890
|
-
|
|
1996
|
+
```
|
|
1997
|
+
cordova.plugins.diagnostic.requestBluetoothAuthorization(successCallback, errorCallback);
|
|
1998
|
+
```
|
|
1891
1999
|
|
|
1892
2000
|
#### Parameters
|
|
1893
2001
|
|
|
@@ -1930,9 +2038,9 @@ The function is passed a single string parameter which indicates the Bluetooth s
|
|
|
1930
2038
|
#### Example usage
|
|
1931
2039
|
|
|
1932
2040
|
cordova.plugins.diagnostic.registerBluetoothStateChangeHandler(function(state){
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
2041
|
+
if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){
|
|
2042
|
+
console.log("Bluetooth is able to connect");
|
|
2043
|
+
}
|
|
1936
2044
|
});
|
|
1937
2045
|
|
|
1938
2046
|
|
|
@@ -2088,10 +2196,11 @@ Notes for Android:
|
|
|
2088
2196
|
- On Android by default this checks run-time permission for both `READ_EXTERNAL_STORAGE` and `CAMERA` because [cordova-plugin-camera@2.2+](https://github.com/apache/cordova-plugin-camera) requires both of these permissions.
|
|
2089
2197
|
- The call signature `cordova.plugins.diagnostic.isCameraAvailable(successCallback, errorCallback, externalStorage)` is also supported for benefit of the [ionic-native Promise API wrapper](https://github.com/driftyco/ionic-native/blob/master/src/%40ionic-native/plugins/diagnostic/index.ts).
|
|
2090
2198
|
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2199
|
+
```
|
|
2200
|
+
cordova.plugins.diagnostic.isCameraAvailable(params);
|
|
2201
|
+
cordova.plugins.diagnostic.isCameraAvailable(successCallback, errorCallback, params)
|
|
2202
|
+
cordova.plugins.diagnostic.isCameraAvailable(successCallback, errorCallback, externalStorage)
|
|
2203
|
+
```
|
|
2095
2204
|
|
|
2096
2205
|
#### Parameters
|
|
2097
2206
|
- {Object} params - (optional) parameters:
|
|
@@ -2144,10 +2253,11 @@ Notes for Android:
|
|
|
2144
2253
|
- By default this checks run-time permission for both `READ_EXTERNAL_STORAGE` and `CAMERA` because [cordova-plugin-camera@2.2+](https://github.com/apache/cordova-plugin-camera) requires both of these permissions.
|
|
2145
2254
|
- The call signature `cordova.plugins.diagnostic.isCameraAuthorized(successCallback, errorCallback, externalStorage)` is also supported for benefit of the [ionic-native Promise API wrapper](https://github.com/driftyco/ionic-native/blob/master/src/%40ionic-native/plugins/diagnostic/index.ts).
|
|
2146
2255
|
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2256
|
+
```
|
|
2257
|
+
cordova.plugins.diagnostic.isCameraAuthorized(params);
|
|
2258
|
+
cordova.plugins.diagnostic.isCameraAuthorized(successCallback, errorCallback, params)
|
|
2259
|
+
cordova.plugins.diagnostic.isCameraAuthorized(successCallback, errorCallback, externalStorage)
|
|
2260
|
+
```
|
|
2151
2261
|
|
|
2152
2262
|
#### Parameters
|
|
2153
2263
|
- {Object} params - (optional) parameters:
|
|
@@ -2199,10 +2309,11 @@ Notes for Android:
|
|
|
2199
2309
|
- By default this checks run-time permission for both `READ_EXTERNAL_STORAGE` and `CAMERA` because [cordova-plugin-camera@2.2+](https://github.com/apache/cordova-plugin-camera) requires both of these permissions.
|
|
2200
2310
|
- The call signature `cordova.plugins.diagnostic.getCameraAuthorizationStatus(successCallback, errorCallback, externalStorage)` is also supported for benefit of the [ionic-native Promise API wrapper](https://github.com/driftyco/ionic-native/blob/master/src/%40ionic-native/plugins/diagnostic/index.ts).
|
|
2201
2311
|
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2312
|
+
```
|
|
2313
|
+
cordova.plugins.diagnostic.getCameraAuthorizationStatus(params);
|
|
2314
|
+
cordova.plugins.diagnostic.getCameraAuthorizationStatus(successCallback, errorCallback, params)
|
|
2315
|
+
cordova.plugins.diagnostic.getCameraAuthorizationStatus(successCallback, errorCallback, externalStorage)
|
|
2316
|
+
```
|
|
2206
2317
|
|
|
2207
2318
|
#### Parameters
|
|
2208
2319
|
- {Object} params - (optional) parameters:
|
|
@@ -2268,10 +2379,11 @@ Notes for Android:
|
|
|
2268
2379
|
- Requested run-time permissions which must be added to `AndroidManifest.xml` - see [Android camera permissions](#android-camera-permissions).
|
|
2269
2380
|
- The call signature `cordova.plugins.diagnostic.requestCameraAuthorization(successCallback, errorCallback, externalStorage)` is also supported for benefit of the [ionic-native Promise API wrapper](https://github.com/driftyco/ionic-native/blob/master/src/%40ionic-native/plugins/diagnostic/index.ts).
|
|
2270
2381
|
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2382
|
+
```
|
|
2383
|
+
cordova.plugins.diagnostic.requestCameraAuthorization(params);
|
|
2384
|
+
cordova.plugins.diagnostic.requestCameraAuthorization(successCallback, errorCallback, params)
|
|
2385
|
+
cordova.plugins.diagnostic.requestCameraAuthorization(successCallback, errorCallback, externalStorage)
|
|
2386
|
+
```
|
|
2275
2387
|
|
|
2276
2388
|
#### Parameters
|
|
2277
2389
|
|
|
@@ -2693,7 +2805,9 @@ Checks if the application is authorized to use the microphone.
|
|
|
2693
2805
|
Notes for Android:
|
|
2694
2806
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will always return TRUE as permissions are already granted at installation time.
|
|
2695
2807
|
|
|
2696
|
-
|
|
2808
|
+
```
|
|
2809
|
+
cordova.plugins.diagnostic.isMicrophoneAuthorized(successCallback, errorCallback);
|
|
2810
|
+
```
|
|
2697
2811
|
|
|
2698
2812
|
#### Parameters
|
|
2699
2813
|
|
|
@@ -2720,8 +2834,9 @@ Returns the microphone authorization status for the application.
|
|
|
2720
2834
|
Notes for Android:
|
|
2721
2835
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
|
2722
2836
|
|
|
2723
|
-
|
|
2724
|
-
|
|
2837
|
+
```
|
|
2838
|
+
cordova.plugins.diagnostic.getMicrophoneAuthorizationStatus(successCallback, errorCallback);
|
|
2839
|
+
```
|
|
2725
2840
|
|
|
2726
2841
|
#### Parameters
|
|
2727
2842
|
|
|
@@ -2755,7 +2870,9 @@ Notes for Android:
|
|
|
2755
2870
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will have no effect as the permissions are already granted at installation time.
|
|
2756
2871
|
- This requests permission for `RECORD_AUDIO` which must be added to `AndroidManifest.xml` - see [Android permissions](#android-permissions).
|
|
2757
2872
|
|
|
2758
|
-
|
|
2873
|
+
```
|
|
2874
|
+
cordova.plugins.diagnostic.requestMicrophoneAuthorization(successCallback, errorCallback);
|
|
2875
|
+
```
|
|
2759
2876
|
|
|
2760
2877
|
#### Parameters
|
|
2761
2878
|
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
@@ -2790,7 +2907,9 @@ Checks if the application is authorized to use contacts (address book).
|
|
|
2790
2907
|
Notes for Android:
|
|
2791
2908
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will always return TRUE as permissions are already granted at installation time.
|
|
2792
2909
|
|
|
2793
|
-
|
|
2910
|
+
```
|
|
2911
|
+
cordova.plugins.diagnostic.isContactsAuthorized(successCallback, errorCallback);
|
|
2912
|
+
```
|
|
2794
2913
|
|
|
2795
2914
|
#### Parameters
|
|
2796
2915
|
|
|
@@ -2817,7 +2936,9 @@ Returns the contacts authorization status for the application.
|
|
|
2817
2936
|
Notes for Android:
|
|
2818
2937
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
|
2819
2938
|
|
|
2820
|
-
|
|
2939
|
+
```
|
|
2940
|
+
cordova.plugins.diagnostic.getContactsAuthorizationStatus(successCallback, errorCallback);
|
|
2941
|
+
```
|
|
2821
2942
|
|
|
2822
2943
|
#### Parameters
|
|
2823
2944
|
|
|
@@ -2852,7 +2973,9 @@ Notes for Android:
|
|
|
2852
2973
|
- This requests permission for `READ_CONTACTS` run-time permission
|
|
2853
2974
|
- Required permissions must be added to `AndroidManifest.xml` as appropriate - see [Android permissions](#android-permissions): `READ_CONTACTS, WRITE_CONTACTS, GET_ACCOUNTS`
|
|
2854
2975
|
|
|
2855
|
-
|
|
2976
|
+
```
|
|
2977
|
+
cordova.plugins.diagnostic.requestContactsAuthorization(successCallback, errorCallback);
|
|
2978
|
+
```
|
|
2856
2979
|
|
|
2857
2980
|
#### Parameters
|
|
2858
2981
|
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
@@ -2891,7 +3014,9 @@ Notes for Android:
|
|
|
2891
3014
|
Notes for iOS:
|
|
2892
3015
|
- This relates to Calendar Events (not Calendar Reminders)
|
|
2893
3016
|
|
|
2894
|
-
|
|
3017
|
+
```
|
|
3018
|
+
cordova.plugins.diagnostic.isCalendarAuthorized(successCallback, errorCallback);
|
|
3019
|
+
```
|
|
2895
3020
|
|
|
2896
3021
|
#### Parameters
|
|
2897
3022
|
|
|
@@ -2921,7 +3046,9 @@ Notes for Android:
|
|
|
2921
3046
|
Notes for iOS:
|
|
2922
3047
|
- This relates to Calendar Events (not Calendar Reminders)
|
|
2923
3048
|
|
|
2924
|
-
|
|
3049
|
+
```
|
|
3050
|
+
cordova.plugins.diagnostic.getCalendarAuthorizationStatus(successCallback, errorCallback);
|
|
3051
|
+
```
|
|
2925
3052
|
|
|
2926
3053
|
#### Parameters
|
|
2927
3054
|
|
|
@@ -2957,7 +3084,9 @@ Notes for Android:
|
|
|
2957
3084
|
- This requests permission for `READ_CALENDAR` run-time permission
|
|
2958
3085
|
- Required permissions must be added to `AndroidManifest.xml` as appropriate - see [Android permissions](#android-permissions): `READ_CALENDAR, WRITE_CALENDAR`
|
|
2959
3086
|
|
|
2960
|
-
|
|
3087
|
+
```
|
|
3088
|
+
cordova.plugins.diagnostic.requestCalendarAuthorization(successCallback, errorCallback);
|
|
3089
|
+
```
|
|
2961
3090
|
|
|
2962
3091
|
#### Parameters
|
|
2963
3092
|
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
@@ -3247,11 +3376,11 @@ Defines constants for the various NFC power states.
|
|
|
3247
3376
|
|
|
3248
3377
|
#### Values
|
|
3249
3378
|
|
|
3250
|
-
- `UNKNOWN` -
|
|
3251
|
-
- `POWERED_OFF` -
|
|
3252
|
-
- `POWERED_ON` -
|
|
3253
|
-
- `POWERING_OFF`-
|
|
3254
|
-
- `POWERING_ON`-
|
|
3379
|
+
- `UNKNOWN` - NFC hardware state is unknown or unavailable
|
|
3380
|
+
- `POWERED_OFF` - NFC hardware is switched off
|
|
3381
|
+
- `POWERED_ON` - NFC hardware is switched on and available for use
|
|
3382
|
+
- `POWERING_OFF`- NFC hardware is currently switching off
|
|
3383
|
+
- `POWERING_ON`- NFC hardware is currently switching on
|
|
3255
3384
|
|
|
3256
3385
|
#### Example
|
|
3257
3386
|
|
|
@@ -3312,7 +3441,7 @@ Checks if the device setting for NFC is switched on.
|
|
|
3312
3441
|
|
|
3313
3442
|
Note: this operation **does not** require NFC permission in the manifest.
|
|
3314
3443
|
|
|
3315
|
-
cordova.plugins.diagnostic.
|
|
3444
|
+
cordova.plugins.diagnostic.isNFCEnabled(successCallback, errorCallback);
|
|
3316
3445
|
|
|
3317
3446
|
#### Parameters
|
|
3318
3447
|
|
|
@@ -3407,7 +3536,9 @@ Notes for Android:
|
|
|
3407
3536
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will always return TRUE as permissions are already granted at installation time.
|
|
3408
3537
|
- This checks for `READ_EXTERNAL_STORAGE` `CAMERA` run-time permission.
|
|
3409
3538
|
|
|
3410
|
-
|
|
3539
|
+
```
|
|
3540
|
+
cordova.plugins.diagnostic.isExternalStorageAuthorized(successCallback, errorCallback);
|
|
3541
|
+
```
|
|
3411
3542
|
|
|
3412
3543
|
#### Parameters
|
|
3413
3544
|
|
|
@@ -3435,7 +3566,9 @@ Notes for Android:
|
|
|
3435
3566
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
|
3436
3567
|
- This checks for `READ_EXTERNAL_STORAGE` run-time permission.
|
|
3437
3568
|
|
|
3438
|
-
|
|
3569
|
+
```
|
|
3570
|
+
cordova.plugins.diagnostic.getExternalStorageAuthorizationStatus(successCallback, errorCallback);
|
|
3571
|
+
```
|
|
3439
3572
|
|
|
3440
3573
|
#### Parameters
|
|
3441
3574
|
|
|
@@ -3463,7 +3596,9 @@ Requests external storage authorization for the application.
|
|
|
3463
3596
|
- This is intended for Android 6 / API 23 and above. Calling on Android 5.1 / API 22 and below will have no effect as the permissions are already granted at installation time.
|
|
3464
3597
|
- This requests permission for `READ_EXTERNAL_STORAGE` run-time permission which must be added to `AndroidManifest.xml`.
|
|
3465
3598
|
|
|
3466
|
-
|
|
3599
|
+
```
|
|
3600
|
+
cordova.plugins.diagnostic.requestExternalStorageAuthorization(successCallback, errorCallback);
|
|
3601
|
+
```
|
|
3467
3602
|
|
|
3468
3603
|
#### Parameters
|
|
3469
3604
|
|
|
@@ -3492,34 +3627,36 @@ This differs from the "external directories" returned by [cordova-plugin-file](h
|
|
|
3492
3627
|
|
|
3493
3628
|
For example, on a Samsung Galaxy S4 running Android 7.1.1:
|
|
3494
3629
|
|
|
3495
|
-
|
|
3496
|
-
|
|
3630
|
+
- `cordova.file.externalRootDirectory` returns `file:///storage/emulated/0/`
|
|
3631
|
+
- `cordova.file.externalApplicationStorageDirectory` returns `file:///storage/emulated/0/Android/data/cordova.plugins.diagnostic.example/`
|
|
3497
3632
|
|
|
3498
|
-
|
|
3633
|
+
which are on non-removable internal storage.
|
|
3499
3634
|
|
|
3500
|
-
|
|
3635
|
+
Whereas this method returns:
|
|
3501
3636
|
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3637
|
+
```
|
|
3638
|
+
[{
|
|
3639
|
+
"path": "/storage/4975-1401/Android/data/cordova.plugins.diagnostic.example/files",
|
|
3640
|
+
"filePath": "file:///storage/4975-1401/Android/data/cordova.plugins.diagnostic.example/files",
|
|
3641
|
+
"canWrite": true,
|
|
3642
|
+
"freeSpace": 16254009344,
|
|
3643
|
+
"type": "application"
|
|
3644
|
+
}, {
|
|
3645
|
+
"path": "/storage/4975-1401",
|
|
3646
|
+
"filePath": "file:///storage/4975-1401",
|
|
3647
|
+
"canWrite": false,
|
|
3648
|
+
"freeSpace": 16254009344,
|
|
3649
|
+
"type": "root"
|
|
3650
|
+
}]
|
|
3651
|
+
```
|
|
3517
3652
|
|
|
3518
|
-
|
|
3653
|
+
which are on external removable storage.
|
|
3519
3654
|
|
|
3520
3655
|
- Requires permission for `READ_EXTERNAL_STORAGE` run-time permission which must be added to `AndroidManifest.xml`.
|
|
3521
3656
|
|
|
3522
|
-
|
|
3657
|
+
```
|
|
3658
|
+
cordova.plugins.diagnostic.getExternalSdCardDetails(successCallback, errorCallback);
|
|
3659
|
+
```
|
|
3523
3660
|
|
|
3524
3661
|
- Note: this function is intended to find paths of external removable SD cards on which the SD card adapter is directly mounted on the device, such as those in the Samsung Galaxy S range of devices. It explicitly attempts to filter out non-SD card storage paths such as OTG devices since access to these devices on Android 6.+ via the File API requires root access and normal access requires use of the Storage Access Framework.
|
|
3525
3662
|
|
|
@@ -305,6 +305,55 @@ interface Diagnostic {
|
|
|
305
305
|
successCallback: () => void
|
|
306
306
|
) => void;
|
|
307
307
|
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* ANDROID ONLY
|
|
311
|
+
*
|
|
312
|
+
* Checks if airplane mode is enabled on device.
|
|
313
|
+
*
|
|
314
|
+
* @param successCallback
|
|
315
|
+
* @param errorCallback
|
|
316
|
+
*/
|
|
317
|
+
isAirplaneModeEnabled?: (
|
|
318
|
+
successCallback: () => boolean,
|
|
319
|
+
errorCallback: (error: string) => void
|
|
320
|
+
) => void;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* ANDROID ONLY
|
|
324
|
+
*
|
|
325
|
+
* Checks if mobile data is enabled on device.
|
|
326
|
+
*
|
|
327
|
+
* @param successCallback
|
|
328
|
+
* @param errorCallback
|
|
329
|
+
*/
|
|
330
|
+
isMobileDataEnabled?: (
|
|
331
|
+
successCallback: () => boolean,
|
|
332
|
+
errorCallback: (error: string) => void
|
|
333
|
+
) => void;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Returns details of the OS of the device on which the app is currently running
|
|
337
|
+
*
|
|
338
|
+
* @param successCallback
|
|
339
|
+
* @param errorCallback
|
|
340
|
+
*/
|
|
341
|
+
getDeviceOSVersion?: (
|
|
342
|
+
successCallback: (details: {version: string, apiLevel: number, apiName: string}) => void,
|
|
343
|
+
errorCallback: (error: string) => void
|
|
344
|
+
) => void;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Returns details of the SDK levels used to build the app.
|
|
348
|
+
*
|
|
349
|
+
* @param successCallback
|
|
350
|
+
* @param errorCallback
|
|
351
|
+
*/
|
|
352
|
+
getBuildOSVersion?: (
|
|
353
|
+
successCallback: (details: {targetApiLevel: number, targetApiName: string, minApiLevel: number, minApiName: string}) => void,
|
|
354
|
+
errorCallback: (error: string) => void
|
|
355
|
+
) => void;
|
|
356
|
+
|
|
308
357
|
/**
|
|
309
358
|
* Returns true if the device setting for location is on.
|
|
310
359
|
* On Android this returns true if Location Mode is switched on.
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
|
3
3
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
4
|
id="cordova.plugins.diagnostic"
|
|
5
|
-
version="7.
|
|
5
|
+
version="7.1.1">
|
|
6
6
|
|
|
7
7
|
<name>Diagnostic</name>
|
|
8
8
|
<description>Cordova/Phonegap plugin to check the state of Location/WiFi/Camera/Bluetooth device settings.</description>
|
|
@@ -26,6 +26,7 @@ import static android.content.Context.BATTERY_SERVICE;
|
|
|
26
26
|
import java.io.BufferedReader;
|
|
27
27
|
import java.io.File;
|
|
28
28
|
import java.io.InputStreamReader;
|
|
29
|
+
import java.lang.reflect.Field;
|
|
29
30
|
import java.lang.reflect.Method;
|
|
30
31
|
import java.util.Collections;
|
|
31
32
|
import java.util.HashMap;
|
|
@@ -47,7 +48,9 @@ import android.app.Activity;
|
|
|
47
48
|
import android.app.AlarmManager;
|
|
48
49
|
import android.app.PendingIntent;
|
|
49
50
|
import android.content.SharedPreferences;
|
|
51
|
+
import android.content.pm.ApplicationInfo;
|
|
50
52
|
import android.content.pm.PackageInfo;
|
|
53
|
+
import android.net.ConnectivityManager;
|
|
51
54
|
import android.net.Uri;
|
|
52
55
|
import android.os.BatteryManager;
|
|
53
56
|
import android.os.Build;
|
|
@@ -276,6 +279,8 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
276
279
|
callbackContext.success(isADBModeEnabled() ? 1 : 0);
|
|
277
280
|
} else if(action.equals("isDeviceRooted")) {
|
|
278
281
|
callbackContext.success(isDeviceRooted() ? 1 : 0);
|
|
282
|
+
} else if(action.equals("isMobileDataEnabled")) {
|
|
283
|
+
callbackContext.success(isMobileDataEnabled() ? 1 : 0);
|
|
279
284
|
} else if(action.equals("restart")) {
|
|
280
285
|
this.restart(args);
|
|
281
286
|
} else if(action.equals("getArchitecture")) {
|
|
@@ -284,6 +289,10 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
284
289
|
callbackContext.success(getCurrentBatteryLevel());
|
|
285
290
|
} else if(action.equals("isAirplaneModeEnabled")) {
|
|
286
291
|
callbackContext.success(isAirplaneModeEnabled() ? 1 : 0);
|
|
292
|
+
} else if(action.equals("getDeviceOSVersion")) {
|
|
293
|
+
callbackContext.success(getDeviceOSVersion());
|
|
294
|
+
} else if(action.equals("getBuildOSVersion")) {
|
|
295
|
+
callbackContext.success(getBuildOSVersion());
|
|
287
296
|
} else {
|
|
288
297
|
handleError("Invalid action");
|
|
289
298
|
return false;
|
|
@@ -439,12 +448,27 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
439
448
|
return false;
|
|
440
449
|
}
|
|
441
450
|
|
|
451
|
+
// https://stackoverflow.com/a/12864897/777265
|
|
452
|
+
public boolean isMobileDataEnabled(){
|
|
453
|
+
boolean mobileDataEnabled = false; // Assume disabled
|
|
454
|
+
ConnectivityManager cm = (ConnectivityManager) cordova.getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
455
|
+
try {
|
|
456
|
+
Class cmClass = Class.forName(cm.getClass().getName());
|
|
457
|
+
Method method = cmClass.getDeclaredMethod("getMobileDataEnabled");
|
|
458
|
+
method.setAccessible(true);
|
|
459
|
+
mobileDataEnabled = (Boolean)method.invoke(cm);
|
|
460
|
+
} catch (Exception e) {
|
|
461
|
+
logDebug(e.getMessage());
|
|
462
|
+
}
|
|
463
|
+
return mobileDataEnabled;
|
|
464
|
+
}
|
|
442
465
|
|
|
443
466
|
/************
|
|
444
467
|
* Internals
|
|
445
468
|
***********/
|
|
446
469
|
|
|
447
470
|
public void logDebug(String msg) {
|
|
471
|
+
if(msg == null) return;
|
|
448
472
|
if(debugEnabled){
|
|
449
473
|
Log.d(TAG, msg);
|
|
450
474
|
executeGlobalJavascript("console.log(\""+TAG+"[native]: "+escapeDoubleQuotes(msg)+"\")");
|
|
@@ -452,6 +476,7 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
452
476
|
}
|
|
453
477
|
|
|
454
478
|
public void logInfo(String msg){
|
|
479
|
+
if(msg == null) return;
|
|
455
480
|
Log.i(TAG, msg);
|
|
456
481
|
if(debugEnabled){
|
|
457
482
|
executeGlobalJavascript("console.info(\""+TAG+"[native]: "+escapeDoubleQuotes(msg)+"\")");
|
|
@@ -459,6 +484,7 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
459
484
|
}
|
|
460
485
|
|
|
461
486
|
public void logWarning(String msg){
|
|
487
|
+
if(msg == null) return;
|
|
462
488
|
Log.w(TAG, msg);
|
|
463
489
|
if(debugEnabled){
|
|
464
490
|
executeGlobalJavascript("console.warn(\""+TAG+"[native]: "+escapeDoubleQuotes(msg)+"\")");
|
|
@@ -466,6 +492,7 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
466
492
|
}
|
|
467
493
|
|
|
468
494
|
public void logError(String msg){
|
|
495
|
+
if(msg == null) return;
|
|
469
496
|
Log.e(TAG, msg);
|
|
470
497
|
if(debugEnabled){
|
|
471
498
|
executeGlobalJavascript("console.error(\""+TAG+"[native]: "+escapeDoubleQuotes(msg)+"\")");
|
|
@@ -823,7 +850,45 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
823
850
|
Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
|
|
824
851
|
}
|
|
825
852
|
|
|
853
|
+
public JSONObject getDeviceOSVersion() throws Exception{
|
|
854
|
+
JSONObject details = new JSONObject();
|
|
855
|
+
details.put("version", Build.VERSION.RELEASE);
|
|
856
|
+
details.put("apiLevel", Build.VERSION.SDK_INT);
|
|
857
|
+
details.put("apiName", getNameForApiLevel(Build.VERSION.SDK_INT));
|
|
858
|
+
return details;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
public JSONObject getBuildOSVersion() throws Exception{
|
|
862
|
+
JSONObject details = new JSONObject();
|
|
863
|
+
int targetVersion = 0;
|
|
864
|
+
int minVersion = 0;
|
|
865
|
+
Activity activity = instance.cordova.getActivity();
|
|
866
|
+
ApplicationInfo applicationInfo = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), 0);
|
|
867
|
+
if (applicationInfo != null) {
|
|
868
|
+
targetVersion = applicationInfo.targetSdkVersion;
|
|
869
|
+
if(Build.VERSION.SDK_INT >= 24){
|
|
870
|
+
minVersion = applicationInfo.minSdkVersion;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
details.put("targetApiLevel", targetVersion);
|
|
875
|
+
details.put("targetApiName", getNameForApiLevel(targetVersion));
|
|
876
|
+
details.put("minApiLevel", minVersion);
|
|
877
|
+
details.put("minApiName", getNameForApiLevel(minVersion));
|
|
878
|
+
return details;
|
|
879
|
+
}
|
|
826
880
|
|
|
881
|
+
// https://stackoverflow.com/a/55946200/777265
|
|
882
|
+
protected String getNameForApiLevel(int apiLevel) throws Exception{
|
|
883
|
+
Field[] fields = Build.VERSION_CODES.class.getFields();
|
|
884
|
+
String codeName = "UNKNOWN";
|
|
885
|
+
for (Field field : fields) {
|
|
886
|
+
if (field.getInt(Build.VERSION_CODES.class) == apiLevel) {
|
|
887
|
+
codeName = field.getName();
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
return codeName;
|
|
891
|
+
}
|
|
827
892
|
|
|
828
893
|
/************
|
|
829
894
|
* Overrides
|
package/src/ios/Diagnostic.h
CHANGED
|
@@ -35,6 +35,9 @@ extern NSString*const AUTHORIZATION_LIMITED;
|
|
|
35
35
|
- (void) getBackgroundRefreshStatus: (CDVInvokedUrlCommand*)command;
|
|
36
36
|
- (void) getArchitecture: (CDVInvokedUrlCommand*)command;
|
|
37
37
|
- (void) getCurrentBatteryLevel: (CDVInvokedUrlCommand*)command;
|
|
38
|
+
- (void) getDeviceOSVersion: (CDVInvokedUrlCommand*)command;
|
|
39
|
+
- (void) getBuildOSVersion: (CDVInvokedUrlCommand*)command;
|
|
40
|
+
- (void) isMobileDataEnabled: (CDVInvokedUrlCommand*)command;
|
|
38
41
|
|
|
39
42
|
// Utilities
|
|
40
43
|
+ (id) getInstance;
|
package/src/ios/Diagnostic.m
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
#import "Diagnostic.h"
|
|
10
|
+
#import <CoreTelephony/CTCellularData.h>
|
|
10
11
|
|
|
11
12
|
@implementation Diagnostic
|
|
12
13
|
|
|
@@ -29,7 +30,9 @@ static NSString*const CPU_ARCH_ARMv8 = @"ARMv8";
|
|
|
29
30
|
static NSString*const CPU_ARCH_X86 = @"X86";
|
|
30
31
|
static NSString*const CPU_ARCH_X86_64 = @"X86_64";
|
|
31
32
|
|
|
33
|
+
// Internal properties
|
|
32
34
|
static Diagnostic* diagnostic = nil;
|
|
35
|
+
static CTCellularData* cellularData;
|
|
33
36
|
|
|
34
37
|
/********************************/
|
|
35
38
|
#pragma mark - Public static functions
|
|
@@ -111,6 +114,7 @@ static Diagnostic* diagnostic = nil;
|
|
|
111
114
|
|
|
112
115
|
self.debugEnabled = false;
|
|
113
116
|
self.osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
|
|
117
|
+
cellularData = [[CTCellularData alloc] init];
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
// https://stackoverflow.com/a/38441011/777265
|
|
@@ -171,6 +175,60 @@ static Diagnostic* diagnostic = nil;
|
|
|
171
175
|
}];
|
|
172
176
|
}
|
|
173
177
|
|
|
178
|
+
- (void) getDeviceOSVersion: (CDVInvokedUrlCommand*)command {
|
|
179
|
+
[self.commandDelegate runInBackground:^{
|
|
180
|
+
@try {
|
|
181
|
+
NSString* s_version = [UIDevice currentDevice].systemVersion;
|
|
182
|
+
float f_version = [s_version floatValue];
|
|
183
|
+
|
|
184
|
+
NSDictionary* details = @{
|
|
185
|
+
@"version": s_version,
|
|
186
|
+
@"apiLevel" : [NSNumber numberWithFloat:f_version*10000],
|
|
187
|
+
@"apiName": s_version
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
[self sendPluginResultObject:details:command];
|
|
191
|
+
}@catch (NSException *exception) {
|
|
192
|
+
[self handlePluginException:exception :command];
|
|
193
|
+
}
|
|
194
|
+
}];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
- (void) getBuildOSVersion: (CDVInvokedUrlCommand*)command {
|
|
198
|
+
[self.commandDelegate runInBackground:^{
|
|
199
|
+
@try {
|
|
200
|
+
int i_min_version = __IPHONE_OS_VERSION_MIN_REQUIRED;
|
|
201
|
+
NSString* s_min_version = [NSString stringWithFormat:@"%.01f", (float) i_min_version/10000];
|
|
202
|
+
int i_target_version = __IPHONE_OS_VERSION_MAX_ALLOWED;
|
|
203
|
+
NSString* s_target_version = [NSString stringWithFormat:@"%.01f", (float) i_target_version/10000];
|
|
204
|
+
|
|
205
|
+
NSDictionary* details = @{
|
|
206
|
+
@"targetApiLevel": [NSNumber numberWithInt:i_target_version],
|
|
207
|
+
@"targetApiName": s_target_version,
|
|
208
|
+
@"minApiLevel": [NSNumber numberWithInt:i_min_version],
|
|
209
|
+
@"minApiName": s_min_version
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
[self sendPluginResultObject:details:command];
|
|
213
|
+
}@catch (NSException *exception) {
|
|
214
|
+
[self handlePluginException:exception :command];
|
|
215
|
+
}
|
|
216
|
+
}];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
- (void) isMobileDataEnabled: (CDVInvokedUrlCommand*)command
|
|
220
|
+
{
|
|
221
|
+
[self.commandDelegate runInBackground:^{
|
|
222
|
+
@try {
|
|
223
|
+
bool isEnabled = cellularData.restrictedState == kCTCellularDataNotRestricted;;
|
|
224
|
+
[diagnostic sendPluginResultBool:isEnabled :command];
|
|
225
|
+
}
|
|
226
|
+
@catch (NSException *exception) {
|
|
227
|
+
[diagnostic handlePluginException:exception :command];
|
|
228
|
+
}
|
|
229
|
+
}];
|
|
230
|
+
}
|
|
231
|
+
|
|
174
232
|
|
|
175
233
|
/********************************/
|
|
176
234
|
#pragma mark - Send results
|
|
@@ -214,6 +272,12 @@ static Diagnostic* diagnostic = nil;
|
|
|
214
272
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
215
273
|
}
|
|
216
274
|
|
|
275
|
+
- (void) sendPluginResultObject: (NSDictionary*)result :(CDVInvokedUrlCommand*)command
|
|
276
|
+
{
|
|
277
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result];
|
|
278
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
279
|
+
}
|
|
280
|
+
|
|
217
281
|
- (void) sendPluginError: (NSString*) errorMessage :(CDVInvokedUrlCommand*)command
|
|
218
282
|
{
|
|
219
283
|
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMessage];
|
|
@@ -65,20 +65,17 @@ static NSString*const LOG_TAG = @"Diagnostic_Bluetooth[native]";
|
|
|
65
65
|
{
|
|
66
66
|
[self.commandDelegate runInBackground:^{
|
|
67
67
|
@try {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
[diagnostic
|
|
75
|
-
|
|
76
|
-
[self
|
|
77
|
-
[
|
|
78
|
-
}else{
|
|
79
|
-
[diagnostic logDebug:@"Bluetooth authorization is already granted"];
|
|
68
|
+
|
|
69
|
+
NSString* authState = [self getAuthorizationStatus];
|
|
70
|
+
|
|
71
|
+
if([authState isEqual:AUTHORIZATION_GRANTED]){
|
|
72
|
+
[diagnostic sendPluginError:@"Bluetooth authorization is already granted" :command];
|
|
73
|
+
}else if([authState isEqual:AUTHORIZATION_DENIED]){
|
|
74
|
+
[diagnostic sendPluginError:@"Bluetooth authorization has been denied" :command];
|
|
75
|
+
}else{ // AUTHORIZATION_NOT_DETERMINED
|
|
76
|
+
[self ensureBluetoothManager]; // invoke Bluetooth manager to trigger permission dialog
|
|
77
|
+
[diagnostic sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] :command];
|
|
80
78
|
}
|
|
81
|
-
[diagnostic sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] :command];
|
|
82
79
|
}
|
|
83
80
|
@catch (NSException *exception) {
|
|
84
81
|
[diagnostic handlePluginException:exception :command];
|
|
@@ -473,6 +473,61 @@ var Diagnostic = (function(){
|
|
|
473
473
|
[]);
|
|
474
474
|
};
|
|
475
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Checks if mobile data is enabled on device.
|
|
478
|
+
*
|
|
479
|
+
* @param {Function} successCallback - The callback which will be called when the operation is successful.
|
|
480
|
+
* This callback function is passed a single boolean parameter which is TRUE if mobile data is enabled.
|
|
481
|
+
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
|
|
482
|
+
* This callback function is passed a single string parameter containing the error message.
|
|
483
|
+
*/
|
|
484
|
+
Diagnostic.isMobileDataEnabled = function(successCallback, errorCallback) {
|
|
485
|
+
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
|
|
486
|
+
errorCallback,
|
|
487
|
+
'Diagnostic',
|
|
488
|
+
'isMobileDataEnabled',
|
|
489
|
+
[]);
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Returns details of the OS of the device on which the app is currently running
|
|
494
|
+
*
|
|
495
|
+
* @param {Function} successCallback - The callback which will be called when the operation is successful.
|
|
496
|
+
* This callback function is passed a single object parameter with the following fields:
|
|
497
|
+
* - {string} version - version string of the OS e.g. "11.0"
|
|
498
|
+
* - {integer} apiLevel - API level of the OS e.g. 30
|
|
499
|
+
* - {string} apiName - code name for API level e.g. "FROYO"
|
|
500
|
+
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
|
|
501
|
+
* This callback function is passed a single string parameter containing the error message.
|
|
502
|
+
*/
|
|
503
|
+
Diagnostic.getDeviceOSVersion = function(successCallback, errorCallback) {
|
|
504
|
+
return cordova.exec(successCallback,
|
|
505
|
+
errorCallback,
|
|
506
|
+
'Diagnostic',
|
|
507
|
+
'getDeviceOSVersion',
|
|
508
|
+
[]);
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Returns details of the SDK levels used to build the app.
|
|
513
|
+
*
|
|
514
|
+
* @param {Function} successCallback - The callback which will be called when the operation is successful.
|
|
515
|
+
* This callback function is passed a single object parameter with the following fields:
|
|
516
|
+
* - {integer} targetApiLevel - API level of the target SDK (used to build the app)
|
|
517
|
+
* - {string} targetApiName - code name for API level of the target SDK e.g. "FROYO"
|
|
518
|
+
* - {integer} minApiLevel - API level of the minimum SDK (lowest on which the app can be installed)
|
|
519
|
+
* - {string} minApiName - code name for API level of the minimum SDK e.g. "FROYO"
|
|
520
|
+
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
|
|
521
|
+
* This callback function is passed a single string parameter containing the error message.
|
|
522
|
+
*/
|
|
523
|
+
Diagnostic.getBuildOSVersion = function(successCallback, errorCallback) {
|
|
524
|
+
return cordova.exec(successCallback,
|
|
525
|
+
errorCallback,
|
|
526
|
+
'Diagnostic',
|
|
527
|
+
'getBuildOSVersion',
|
|
528
|
+
[]);
|
|
529
|
+
};
|
|
530
|
+
|
|
476
531
|
/************
|
|
477
532
|
* Location *
|
|
478
533
|
************/
|
|
@@ -210,8 +210,7 @@ var Diagnostic_Camera = (function(){
|
|
|
210
210
|
* Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect.
|
|
211
211
|
*
|
|
212
212
|
* @param {Function} successCallback - The callback which will be called when operation is successful.
|
|
213
|
-
* This callback function is passed a single string parameter indicating the new authorization status
|
|
214
|
-
* `cordova.plugins.diagnostic.permissionStatus.GRANTED` or `cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS`
|
|
213
|
+
* This callback function is passed a single string parameter indicating the new authorization status
|
|
215
214
|
* @param {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
216
215
|
* This callback function is passed a single string parameter containing the error message.
|
|
217
216
|
* @param {Function} accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to request as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
|
|
@@ -222,9 +221,8 @@ var Diagnostic_Camera = (function(){
|
|
|
222
221
|
* - Has no effect on iOS 13 or below
|
|
223
222
|
*/
|
|
224
223
|
Diagnostic_Camera.requestCameraRollAuthorization = function(successCallback, errorCallback, accessLevel) {
|
|
225
|
-
return cordova.exec(
|
|
226
|
-
|
|
227
|
-
},
|
|
224
|
+
return cordova.exec(
|
|
225
|
+
successCallback,
|
|
228
226
|
errorCallback,
|
|
229
227
|
'Diagnostic_Camera',
|
|
230
228
|
'requestCameraRollAuthorization',
|
package/www/ios/diagnostic.js
CHANGED
|
@@ -153,6 +153,61 @@ var Diagnostic = (function(){
|
|
|
153
153
|
[]);
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Checks if mobile data is enabled on device.
|
|
158
|
+
*
|
|
159
|
+
* @param {Function} successCallback - The callback which will be called when the operation is successful.
|
|
160
|
+
* This callback function is passed a single boolean parameter which is TRUE if mobile data is enabled.
|
|
161
|
+
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
|
|
162
|
+
* This callback function is passed a single string parameter containing the error message.
|
|
163
|
+
*/
|
|
164
|
+
Diagnostic.isMobileDataEnabled = function(successCallback, errorCallback) {
|
|
165
|
+
return cordova.exec(Diagnostic._ensureBoolean(successCallback),
|
|
166
|
+
errorCallback,
|
|
167
|
+
'Diagnostic',
|
|
168
|
+
'isMobileDataEnabled',
|
|
169
|
+
[]);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Returns details of the OS of the device on which the app is currently running
|
|
174
|
+
*
|
|
175
|
+
* @param {Function} successCallback - The callback which will be called when the operation is successful.
|
|
176
|
+
* This callback function is passed a single object parameter with the following fields:
|
|
177
|
+
* - {string} version - version string of the OS e.g. "11.0"
|
|
178
|
+
* - {integer} apiLevel - API level of the OS e.g. 30
|
|
179
|
+
* - {string} apiName - code name for API level e.g. "FROYO"
|
|
180
|
+
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
|
|
181
|
+
* This callback function is passed a single string parameter containing the error message.
|
|
182
|
+
*/
|
|
183
|
+
Diagnostic.getDeviceOSVersion = function(successCallback, errorCallback) {
|
|
184
|
+
return cordova.exec(successCallback,
|
|
185
|
+
errorCallback,
|
|
186
|
+
'Diagnostic',
|
|
187
|
+
'getDeviceOSVersion',
|
|
188
|
+
[]);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Returns details of the SDK levels used to build the app.
|
|
193
|
+
*
|
|
194
|
+
* @param {Function} successCallback - The callback which will be called when the operation is successful.
|
|
195
|
+
* This callback function is passed a single object parameter with the following fields:
|
|
196
|
+
* - {integer} targetApiLevel - API level of the target SDK (used to build the app)
|
|
197
|
+
* - {string} targetApiName - code name for API level of the target SDK e.g. "FROYO"
|
|
198
|
+
* - {integer} minApiLevel - API level of the minimum SDK (lowest on which the app can be installed)
|
|
199
|
+
* - {string} minApiName - code name for API level of the minimum SDK e.g. "FROYO"
|
|
200
|
+
* @param {Function} errorCallback - The callback which will be called when the operation encounters an error.
|
|
201
|
+
* This callback function is passed a single string parameter containing the error message.
|
|
202
|
+
*/
|
|
203
|
+
Diagnostic.getBuildOSVersion = function(successCallback, errorCallback) {
|
|
204
|
+
return cordova.exec(successCallback,
|
|
205
|
+
errorCallback,
|
|
206
|
+
'Diagnostic',
|
|
207
|
+
'getBuildOSVersion',
|
|
208
|
+
[]);
|
|
209
|
+
};
|
|
210
|
+
|
|
156
211
|
/************
|
|
157
212
|
* Location *
|
|
158
213
|
************/
|