cordova.plugins.diagnostic 7.1.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 +10 -1
- package/README.md +364 -289
- package/cordova.plugins.diagnostic.d.ts +13 -0
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/Diagnostic.java +21 -0
- package/src/ios/Diagnostic.h +1 -0
- package/src/ios/Diagnostic.m +17 -0
- package/src/ios/Diagnostic_Bluetooth.m +10 -13
- package/www/android/diagnostic.js +16 -0
- package/www/ios/diagnostic.camera.js +3 -5
- package/www/ios/diagnostic.js +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
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
|
+
|
|
3
12
|
**v7.1.0**
|
|
4
13
|
* (Android, iOS) feat: add support to fetch device OS and build SDK details
|
|
5
14
|
|
|
6
|
-
**v7.0.0**
|
|
7
15
|
|
|
16
|
+
**v7.0.0**
|
|
8
17
|
* (Android) BREAKING chore: Remove deprecated aliases `cordova.plugins.diagnostic.runtimePermission` and `cordova.plugins.diagnostic.runtimePermissionStatus`
|
|
9
18
|
- Use `cordova.plugins.diagnostic.permission` and `cordova.plugins.diagnostic.permissionStatus` instead.
|
|
10
19
|
* (iOS) feat: Add support for Photo Library access levels on iOS 14+
|
package/README.md
CHANGED
|
@@ -2,154 +2,155 @@ 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
|
-
- [switchToWirelessSettings()](#switchtowirelesssettings)
|
|
26
|
-
- [switchToMobileDataSettings()](#switchtomobiledatasettings)
|
|
27
|
-
- [permissionStatus constants](#permissionstatus-constants)
|
|
28
|
-
- [getPermissionAuthorizationStatus()](#getpermissionauthorizationstatus)
|
|
29
|
-
- [getPermissionsAuthorizationStatus()](#getpermissionsauthorizationstatus)
|
|
30
|
-
- [requestRuntimePermission()](#requestruntimepermission)
|
|
31
|
-
- [requestRuntimePermissions()](#requestruntimepermissions)
|
|
32
|
-
- [isRequestingPermission()](#isrequestingpermission)
|
|
33
|
-
- [registerPermissionRequestCompleteHandler()](#registerpermissionrequestcompletehandler)
|
|
34
|
-
- [isDataRoamingEnabled()](#isdataroamingenabled)
|
|
35
|
-
- [isADBModeEnabled()](#isadbmodeenabled)
|
|
36
|
-
- [isDeviceRooted()](#isdevicerooted)
|
|
37
|
-
- [isBackgroundRefreshAuthorized()](#isbackgroundrefreshauthorized)
|
|
38
|
-
- [getBackgroundRefreshStatus()](#getbackgroundrefreshstatus)
|
|
39
|
-
- [cpuArchitecture constants](#cpuarchitecture-constants)
|
|
40
|
-
- [getArchitecture()](#getarchitecture)
|
|
41
|
-
- [restart()](#restart)
|
|
42
|
-
- [enableDebug()](#enabledebug)
|
|
43
|
-
- [getCurrentBatteryLevel()](#getcurrentbatterylevel)
|
|
44
|
-
- [isAirplaneModeEnabled()](#isairplanemodeenabled)
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
- [
|
|
58
|
-
- [
|
|
59
|
-
- [
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [
|
|
64
|
-
- [
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [
|
|
75
|
-
- [
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
79
|
-
- [
|
|
80
|
-
- [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- [
|
|
84
|
-
- [
|
|
85
|
-
- [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- [
|
|
89
|
-
- [
|
|
90
|
-
- [
|
|
91
|
-
- [
|
|
92
|
-
- [
|
|
93
|
-
- [
|
|
94
|
-
- [
|
|
95
|
-
- [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
- [
|
|
99
|
-
- [
|
|
100
|
-
- [
|
|
101
|
-
- [
|
|
102
|
-
- [
|
|
103
|
-
- [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
- [
|
|
107
|
-
- [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
- [
|
|
111
|
-
- [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
- [
|
|
115
|
-
- [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- [
|
|
119
|
-
- [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
- [
|
|
123
|
-
- [
|
|
124
|
-
- [
|
|
125
|
-
- [
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- [
|
|
129
|
-
- [
|
|
130
|
-
- [
|
|
131
|
-
- [
|
|
132
|
-
- [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- [
|
|
136
|
-
- [
|
|
137
|
-
- [
|
|
138
|
-
- [
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
- [Android
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
- [
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
- [
|
|
148
|
-
- [
|
|
149
|
-
- [
|
|
150
|
-
- [
|
|
151
|
-
|
|
152
|
-
|
|
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
|
+
- [switchToWirelessSettings()](#switchtowirelesssettings)
|
|
26
|
+
- [switchToMobileDataSettings()](#switchtomobiledatasettings)
|
|
27
|
+
- [permissionStatus constants](#permissionstatus-constants)
|
|
28
|
+
- [getPermissionAuthorizationStatus()](#getpermissionauthorizationstatus)
|
|
29
|
+
- [getPermissionsAuthorizationStatus()](#getpermissionsauthorizationstatus)
|
|
30
|
+
- [requestRuntimePermission()](#requestruntimepermission)
|
|
31
|
+
- [requestRuntimePermissions()](#requestruntimepermissions)
|
|
32
|
+
- [isRequestingPermission()](#isrequestingpermission)
|
|
33
|
+
- [registerPermissionRequestCompleteHandler()](#registerpermissionrequestcompletehandler)
|
|
34
|
+
- [isDataRoamingEnabled()](#isdataroamingenabled)
|
|
35
|
+
- [isADBModeEnabled()](#isadbmodeenabled)
|
|
36
|
+
- [isDeviceRooted()](#isdevicerooted)
|
|
37
|
+
- [isBackgroundRefreshAuthorized()](#isbackgroundrefreshauthorized)
|
|
38
|
+
- [getBackgroundRefreshStatus()](#getbackgroundrefreshstatus)
|
|
39
|
+
- [cpuArchitecture constants](#cpuarchitecture-constants)
|
|
40
|
+
- [getArchitecture()](#getarchitecture)
|
|
41
|
+
- [restart()](#restart)
|
|
42
|
+
- [enableDebug()](#enabledebug)
|
|
43
|
+
- [getCurrentBatteryLevel()](#getcurrentbatterylevel)
|
|
44
|
+
- [isAirplaneModeEnabled()](#isairplanemodeenabled)
|
|
45
|
+
- [isMobileDataEnabled()](#ismobiledataenabled)
|
|
46
|
+
- [getDeviceOSVersion()](#getdeviceosversion)
|
|
47
|
+
- [getBuildOSVersion()](#getbuildosversion)
|
|
48
|
+
- [Location module](#location-module)
|
|
49
|
+
- [locationMode constants](#locationmode-constants)
|
|
50
|
+
- [locationAuthorizationMode constants](#locationauthorizationmode-constants)
|
|
51
|
+
- [locationAccuracyAuthorization constants](#locationaccuracyauthorization-constants)
|
|
52
|
+
- [isLocationAvailable()](#islocationavailable)
|
|
53
|
+
- [isLocationEnabled()](#islocationenabled)
|
|
54
|
+
- [isGpsLocationAvailable()](#isgpslocationavailable)
|
|
55
|
+
- [isGpsLocationEnabled()](#isgpslocationenabled)
|
|
56
|
+
- [isNetworkLocationAvailable()](#isnetworklocationavailable)
|
|
57
|
+
- [isNetworkLocationEnabled()](#isnetworklocationenabled)
|
|
58
|
+
- [getLocationMode()](#getlocationmode)
|
|
59
|
+
- [isLocationAuthorized()](#islocationauthorized)
|
|
60
|
+
- [getLocationAuthorizationStatus()](#getlocationauthorizationstatus)
|
|
61
|
+
- [getLocationAuthorizationStatuses()](#getlocationauthorizationstatuses)
|
|
62
|
+
- [requestLocationAuthorization()](#requestlocationauthorization)
|
|
63
|
+
- [registerLocationStateChangeHandler()](#registerlocationstatechangehandler)
|
|
64
|
+
- [getLocationAccuracyAuthorization()](#getlocationaccuracyauthorization)
|
|
65
|
+
- [requestTemporaryFullAccuracyAuthorization()](#requesttemporaryfullaccuracyauthorization)
|
|
66
|
+
- [registerLocationAccuracyAuthorizationChangeHandler()](#registerlocationaccuracyauthorizationchangehandler)
|
|
67
|
+
- [switchToLocationSettings()](#switchtolocationsettings)
|
|
68
|
+
- [Bluetooth module](#bluetooth-module)
|
|
69
|
+
- [bluetoothState constants](#bluetoothstate-constants)
|
|
70
|
+
- [isBluetoothAvailable()](#isbluetoothavailable)
|
|
71
|
+
- [isBluetoothEnabled()](#isbluetoothenabled)
|
|
72
|
+
- [hasBluetoothSupport()](#hasbluetoothsupport)
|
|
73
|
+
- [hasBluetoothLESupport()](#hasbluetoothlesupport)
|
|
74
|
+
- [hasBluetoothLEPeripheralSupport()](#hasbluetoothleperipheralsupport)
|
|
75
|
+
- [getBluetoothState()](#getbluetoothstate)
|
|
76
|
+
- [setBluetoothState()](#setbluetoothstate)
|
|
77
|
+
- [getBluetoothAuthorizationStatus()](#getbluetoothauthorizationstatus)
|
|
78
|
+
- [getBluetoothAuthorizationStatuses()](#getbluetoothauthorizationstatuses)
|
|
79
|
+
- [requestBluetoothAuthorization()](#requestbluetoothauthorization)
|
|
80
|
+
- [registerBluetoothStateChangeHandler()](#registerbluetoothstatechangehandler)
|
|
81
|
+
- [switchToBluetoothSettings()](#switchtobluetoothsettings)
|
|
82
|
+
- [WiFi module](#wifi-module)
|
|
83
|
+
- [isWifiAvailable()](#iswifiavailable)
|
|
84
|
+
- [isWifiEnabled()](#iswifienabled)
|
|
85
|
+
- [setWifiState()](#setwifistate)
|
|
86
|
+
- [switchToWifiSettings()](#switchtowifisettings)
|
|
87
|
+
- [Camera module](#camera-module)
|
|
88
|
+
- [isCameraPresent()](#iscamerapresent)
|
|
89
|
+
- [isCameraAvailable()](#iscameraavailable)
|
|
90
|
+
- [isCameraAuthorized()](#iscameraauthorized)
|
|
91
|
+
- [getCameraAuthorizationStatus()](#getcameraauthorizationstatus)
|
|
92
|
+
- [requestCameraAuthorization()](#requestcameraauthorization)
|
|
93
|
+
- [isCameraRollAuthorized()](#iscamerarollauthorized)
|
|
94
|
+
- [getCameraRollAuthorizationStatus()](#getcamerarollauthorizationstatus)
|
|
95
|
+
- [requestCameraRollAuthorization()](#requestcamerarollauthorization)
|
|
96
|
+
- [presentLimitedLibraryPicker()](#presentlimitedlibrarypicker)
|
|
97
|
+
- [Notifications module](#notifications-module)
|
|
98
|
+
- [remoteNotificationType constants](#remotenotificationtype-constants)
|
|
99
|
+
- [isRemoteNotificationsEnabled()](#isremotenotificationsenabled)
|
|
100
|
+
- [isRegisteredForRemoteNotifications()](#isregisteredforremotenotifications)
|
|
101
|
+
- [getRemoteNotificationTypes()](#getremotenotificationtypes)
|
|
102
|
+
- [getRemoteNotificationsAuthorizationStatus()](#getremotenotificationsauthorizationstatus)
|
|
103
|
+
- [requestRemoteNotificationsAuthorization()](#requestremotenotificationsauthorization)
|
|
104
|
+
- [switchToNotificationSettings()](#switchtonotificationsettings)
|
|
105
|
+
- [Microphone module](#microphone-module)
|
|
106
|
+
- [isMicrophoneAuthorized()](#ismicrophoneauthorized)
|
|
107
|
+
- [getMicrophoneAuthorizationStatus()](#getmicrophoneauthorizationstatus)
|
|
108
|
+
- [requestMicrophoneAuthorization()](#requestmicrophoneauthorization)
|
|
109
|
+
- [Contacts module](#contacts-module)
|
|
110
|
+
- [isContactsAuthorized()](#iscontactsauthorized)
|
|
111
|
+
- [getContactsAuthorizationStatus()](#getcontactsauthorizationstatus)
|
|
112
|
+
- [requestContactsAuthorization()](#requestcontactsauthorization)
|
|
113
|
+
- [Calendar module](#calendar-module)
|
|
114
|
+
- [isCalendarAuthorized()](#iscalendarauthorized)
|
|
115
|
+
- [getCalendarAuthorizationStatus()](#getcalendarauthorizationstatus)
|
|
116
|
+
- [requestCalendarAuthorization()](#requestcalendarauthorization)
|
|
117
|
+
- [Reminders module](#reminders-module)
|
|
118
|
+
- [isRemindersAuthorized()](#isremindersauthorized)
|
|
119
|
+
- [getRemindersAuthorizationStatus()](#getremindersauthorizationstatus)
|
|
120
|
+
- [requestRemindersAuthorization()](#requestremindersauthorization)
|
|
121
|
+
- [Motion module](#motion-module)
|
|
122
|
+
- [motionStatus constants](#motionstatus-constants)
|
|
123
|
+
- [isMotionAvailable()](#ismotionavailable)
|
|
124
|
+
- [isMotionRequestOutcomeAvailable()](#ismotionrequestoutcomeavailable)
|
|
125
|
+
- [requestMotionAuthorization()](#requestmotionauthorization)
|
|
126
|
+
- [getMotionAuthorizationStatus()](#getmotionauthorizationstatus)
|
|
127
|
+
- [NFC module](#nfc-module)
|
|
128
|
+
- [NFCState constants](#nfcstate-constants)
|
|
129
|
+
- [isNFCPresent()](#isnfcpresent)
|
|
130
|
+
- [isNFCEnabled()](#isnfcenabled)
|
|
131
|
+
- [isNFCAvailable()](#isnfcavailable)
|
|
132
|
+
- [registerNFCStateChangeHandler()](#registernfcstatechangehandler)
|
|
133
|
+
- [switchToNFCSettings()](#switchtonfcsettings)
|
|
134
|
+
- [External storage module](#external-storage-module)
|
|
135
|
+
- [isExternalStorageAuthorized()](#isexternalstorageauthorized)
|
|
136
|
+
- [getExternalStorageAuthorizationStatus()](#getexternalstorageauthorizationstatus)
|
|
137
|
+
- [requestExternalStorageAuthorization()](#requestexternalstorageauthorization)
|
|
138
|
+
- [getExternalSdCardDetails()](#getexternalsdcarddetails)
|
|
139
|
+
- [Platform Notes](#platform-notes)
|
|
140
|
+
- [Android](#android)
|
|
141
|
+
- [Android permissions](#android-permissions)
|
|
142
|
+
- [Android Auto Backup](#android-auto-backup)
|
|
143
|
+
- [iOS](#ios)
|
|
144
|
+
- [iOS usage description messages](#ios-usage-description-messages)
|
|
145
|
+
- [Example project](#example-project)
|
|
146
|
+
- [Screenshots](#screenshots)
|
|
147
|
+
- [Android](#android-1)
|
|
148
|
+
- [iOS](#ios-1)
|
|
149
|
+
- [Release notes](#release-notes)
|
|
150
|
+
- [Credits](#credits)
|
|
151
|
+
- [License](#license)
|
|
152
|
+
|
|
153
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
153
154
|
|
|
154
155
|
|
|
155
156
|
# Overview
|
|
@@ -270,20 +271,20 @@ Before [opening a bug issue](https://github.com/dpa99c/cordova-diagnostic-plugin
|
|
|
270
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)
|
|
271
272
|
- This is owned/maintained by [Ionic](https://github.com/ionic-team) and is not part of this plugin
|
|
272
273
|
- Please raise such issues/PRs against [Ionic Native](https://github.com/ionic-team/ionic-native/) instead.
|
|
273
|
-
|
|
274
|
-
|
|
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.
|
|
275
276
|
- Read the above documentation thoroughly
|
|
276
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.
|
|
277
278
|
- Check a similar issue (open or closed) does not already exist against this plugin.
|
|
278
|
-
|
|
279
|
+
- Duplicates or near-duplicates will be closed immediately.
|
|
279
280
|
- When [creating a new issue](https://github.com/dpa99c/cordova-diagnostic-plugin/issues/new/choose)
|
|
280
281
|
- Choose the "Bug report" template
|
|
281
282
|
- Fill out the relevant sections of the template and delete irrelevant sections
|
|
282
283
|
- *WARNING:* Failure to complete the issue template will result in the issue being closed immediately.
|
|
283
284
|
- Reproduce the issue using the [example project](https://github.com/dpa99c/cordova-diagnostic-plugin-example)
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
|
287
288
|
- Include full verbose console output when reporting build issues
|
|
288
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
|
|
289
290
|
- Often the details of an error causing a build failure is hidden away when building with the CLI
|
|
@@ -776,7 +777,7 @@ Platforms: Android and iOS
|
|
|
776
777
|
|
|
777
778
|
Defines constants for the various CPU architectures of the current hardware returned by [getArchitecture()](#getarchitecture).
|
|
778
779
|
|
|
779
|
-
|
|
780
|
+
cordova.plugins.diagnostic.cpuArchitecture
|
|
780
781
|
|
|
781
782
|
#### Android
|
|
782
783
|
|
|
@@ -873,8 +874,9 @@ Enables debug mode, which logs native debug messages to the native and JS consol
|
|
|
873
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.
|
|
874
875
|
- Debug mode is initially disabled on plugin initialisation.
|
|
875
876
|
|
|
876
|
-
|
|
877
|
-
|
|
877
|
+
```
|
|
878
|
+
cordova.plugins.diagnostic.enableDebug(successCallback);
|
|
879
|
+
```
|
|
878
880
|
|
|
879
881
|
#### Parameters
|
|
880
882
|
|
|
@@ -930,7 +932,36 @@ The function is passed a single string parameter containing the error message.
|
|
|
930
932
|
cordova.plugins.diagnostic.isAirplaneModeEnabled(function(enabled){
|
|
931
933
|
console.log(`Airplane mode is currently ${enabled ? 'enabled' : 'disabled'}%`);
|
|
932
934
|
});
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
=======
|
|
933
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
|
+
|
|
934
965
|
### getDeviceOSVersion()
|
|
935
966
|
|
|
936
967
|
Platforms: Android and iOS
|
|
@@ -957,39 +988,39 @@ The function is passed a single string parameter containing the error message.
|
|
|
957
988
|
console.log(`Version: ${details.version}%`); // "13.0"
|
|
958
989
|
console.log(`API level: ${details.apiLevel}%`); // 33
|
|
959
990
|
console.log(`API name: ${details.apiName}%`); // "TIRAMISU"
|
|
960
|
-
});
|
|
961
|
-
|
|
991
|
+
});
|
|
992
|
+
|
|
962
993
|
### getBuildOSVersion()
|
|
963
994
|
|
|
964
995
|
Platforms: Android and iOS
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
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
|
+
|
|
993
1024
|
|
|
994
1025
|
## Location module
|
|
995
1026
|
|
|
@@ -1065,8 +1096,9 @@ Platforms: Android & iOS
|
|
|
1065
1096
|
- Defines constants for the various location accuracy authorization states on iOS 14+ and Android 12+.
|
|
1066
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+
|
|
1067
1098
|
|
|
1068
|
-
|
|
1069
|
-
|
|
1099
|
+
```
|
|
1100
|
+
cordova.plugins.diagnostic.locationAccuracyAuthorization
|
|
1101
|
+
```
|
|
1070
1102
|
|
|
1071
1103
|
#### Values
|
|
1072
1104
|
|
|
@@ -1170,8 +1202,9 @@ Returns true if Location mode is enabled and is set to either:
|
|
|
1170
1202
|
- Device only = GPS hardware only (high accuracy)
|
|
1171
1203
|
- High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
|
1172
1204
|
|
|
1173
|
-
|
|
1174
|
-
|
|
1205
|
+
```
|
|
1206
|
+
cordova.plugins.diagnostic.isGpsLocationEnabled(successCallback, errorCallback);
|
|
1207
|
+
```
|
|
1175
1208
|
|
|
1176
1209
|
#### Parameters
|
|
1177
1210
|
|
|
@@ -1225,8 +1258,9 @@ Returns true if Location mode is enabled and is set to either:
|
|
|
1225
1258
|
- Battery saving = network triangulation and Wifi network IDs (low accuracy)
|
|
1226
1259
|
- High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
|
1227
1260
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1261
|
+
```
|
|
1262
|
+
cordova.plugins.diagnostic.isNetworkLocationEnabled(successCallback, errorCallback);
|
|
1263
|
+
```
|
|
1230
1264
|
|
|
1231
1265
|
#### Parameters
|
|
1232
1266
|
|
|
@@ -1294,7 +1328,9 @@ Notes for Android:
|
|
|
1294
1328
|
- This is intended for Android 6 / API 23 and above.
|
|
1295
1329
|
Calling on Android 5.1 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
|
1296
1330
|
|
|
1297
|
-
|
|
1331
|
+
```
|
|
1332
|
+
cordova.plugins.diagnostic.isLocationAuthorized(successCallback, errorCallback);
|
|
1333
|
+
```
|
|
1298
1334
|
|
|
1299
1335
|
#### Parameters
|
|
1300
1336
|
|
|
@@ -1320,13 +1356,14 @@ Platforms: Android and iOS
|
|
|
1320
1356
|
|
|
1321
1357
|
Returns the location authorization status for the application.
|
|
1322
1358
|
|
|
1323
|
-
Notes for Android:
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
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`.
|
|
1327
1363
|
|
|
1328
|
-
|
|
1329
|
-
|
|
1364
|
+
```
|
|
1365
|
+
cordova.plugins.diagnostic.getLocationAuthorizationStatus(successCallback, errorCallback);
|
|
1366
|
+
```
|
|
1330
1367
|
|
|
1331
1368
|
#### Parameters
|
|
1332
1369
|
|
|
@@ -1380,19 +1417,19 @@ The function is passed a single string parameter containing the error message.
|
|
|
1380
1417
|
}, function(error){
|
|
1381
1418
|
console.error(error);
|
|
1382
1419
|
});
|
|
1383
|
-
|
|
1420
|
+
|
|
1384
1421
|
### getLocationAuthorizationStatuses()
|
|
1385
1422
|
|
|
1386
1423
|
Platforms: Android
|
|
1387
1424
|
|
|
1388
1425
|
Returns the individual location authorization status for each type of location access (`FINE`, `COARSE` and `BACKGROUND`).
|
|
1389
1426
|
|
|
1390
|
-
|
|
1391
|
-
|
|
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`.
|
|
1392
1429
|
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1430
|
+
```
|
|
1431
|
+
cordova.plugins.diagnostic.getLocationAuthorizationStatuses(successCallback, errorCallback);
|
|
1432
|
+
```
|
|
1396
1433
|
|
|
1397
1434
|
#### Parameters
|
|
1398
1435
|
|
|
@@ -1401,22 +1438,23 @@ The function is passed a single array parameter which contains a list indicating
|
|
|
1401
1438
|
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
1402
1439
|
The function is passed a single string parameter containing the error message.
|
|
1403
1440
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
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
|
+
```
|
|
1412
1450
|
|
|
1413
1451
|
### requestLocationAuthorization()
|
|
1414
1452
|
|
|
1415
|
-
|
|
1453
|
+
Platforms: Android and iOS
|
|
1416
1454
|
|
|
1417
|
-
|
|
1455
|
+
Requests location authorization for the application.
|
|
1418
1456
|
|
|
1419
|
-
|
|
1457
|
+
Notes for iOS:
|
|
1420
1458
|
|
|
1421
1459
|
- Authorization can be requested to use location either "when in use" (only in foreground) or "always" (foreground and background).
|
|
1422
1460
|
- This should only be called if authorization status is `NOT_REQUESTED` - calling it when in any other state will have no effect.
|
|
@@ -1432,7 +1470,7 @@ this plugin provides default messages, but you should override them with your sp
|
|
|
1432
1470
|
| WHEN_IN_USE | Allow While Using App | `kCLAuthorizationStatusAuthorizedWhenInUse` | `GRANTED_WHEN_IN_USE` |
|
|
1433
1471
|
| WHEN_IN_USE | Allow Once | `kCLAuthorizationStatusAuthorizedWhenInUse` | `GRANTED_WHEN_IN_USE` |
|
|
1434
1472
|
|
|
1435
|
-
|
|
1473
|
+
Notes for Android:
|
|
1436
1474
|
|
|
1437
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.
|
|
1438
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.
|
|
@@ -1443,12 +1481,14 @@ this plugin provides default messages, but you should override them with your sp
|
|
|
1443
1481
|
- When the plugin is running on/built with Android 12+ / API 31+, you can specify requested location accuracy using the `accuracy` parameter.
|
|
1444
1482
|
- If the build SDK/device version is <= Android 11 / API 30, `FULL` accuracy is implicitly granted.
|
|
1445
1483
|
|
|
1446
|
-
|
|
1484
|
+
```
|
|
1485
|
+
cordova.plugins.diagnostic.requestLocationAuthorization(successCallback, errorCallback, mode, accuracy);
|
|
1486
|
+
```
|
|
1447
1487
|
|
|
1448
1488
|
#### Parameters
|
|
1449
1489
|
|
|
1450
1490
|
- {Function} successCallback - Invoked in response to the user's choice in the permission dialog.
|
|
1451
|
-
|
|
1491
|
+
- It is passed a single string parameter which defines the [resulting authorisation status](#runtime-permission-statuses).
|
|
1452
1492
|
- {Function} errorCallback - The callback which will be called when operation encounters an error.
|
|
1453
1493
|
- The function is passed a single string parameter containing the error message.
|
|
1454
1494
|
- {String} mode - (optional / iOS & Android >= 10) location authorization mode specified as a [locationAuthorizationMode constant](#locationauthorizationmode-constants).
|
|
@@ -1516,7 +1556,7 @@ On iOS, the function is passed a single string parameter indicating the new loca
|
|
|
1516
1556
|
|
|
1517
1557
|
### getLocationAccuracyAuthorization()
|
|
1518
1558
|
|
|
1519
|
-
Platforms: Android & iOS
|
|
1559
|
+
Platforms: Android & iOS
|
|
1520
1560
|
|
|
1521
1561
|
Returns the location accuracy authorization for the application on iOS 14+ and Android 12+.
|
|
1522
1562
|
Note: calling on iOS <14 or Android <12 will always return `cordova.plugins.diagnostic.locationAccuracyAuthorization.FULL`.
|
|
@@ -1572,8 +1612,9 @@ You'll need to add this entry using a `<config-file>` block in your `config.xml`
|
|
|
1572
1612
|
- Should only be called if location authorization has been granted, otherwise `errorCallback` will be invoked.
|
|
1573
1613
|
- See [requestTemporaryFullAccuracyAuthorizationWithPurposeKey](https://developer.apple.com/documentation/corelocation/cllocationmanager/3600217-requesttemporaryfullaccuracyauth?language=objc).
|
|
1574
1614
|
|
|
1575
|
-
|
|
1576
|
-
|
|
1615
|
+
```
|
|
1616
|
+
cordova.plugins.diagnostic.requestTemporaryFullAccuracyAuthorization(purpose, successCallback, errorCallback);
|
|
1617
|
+
```
|
|
1577
1618
|
|
|
1578
1619
|
#### Parameters
|
|
1579
1620
|
|
|
@@ -1657,7 +1698,7 @@ Platforms: Android and iOS
|
|
|
1657
1698
|
|
|
1658
1699
|
Defines constants for the various Bluetooth hardware states
|
|
1659
1700
|
|
|
1660
|
-
|
|
1701
|
+
cordova.plugins.diagnostic.bluetoothState
|
|
1661
1702
|
|
|
1662
1703
|
#### Android
|
|
1663
1704
|
|
|
@@ -1886,10 +1927,11 @@ Android:
|
|
|
1886
1927
|
|
|
1887
1928
|
iOS:
|
|
1888
1929
|
- On iOS 13+ returns the Bluetooth authorization status of application
|
|
1889
|
-
- On iOS 12 and below, always return GRANTED as Bluetooth permission is not required.
|
|
1890
|
-
|
|
1930
|
+
- On iOS 12 and below, always return GRANTED as Bluetooth permission is not required.
|
|
1891
1931
|
|
|
1892
|
-
|
|
1932
|
+
```
|
|
1933
|
+
cordova.plugins.diagnostic.getBluetoothAuthorizationStatus(successCallback, errorCallback);
|
|
1934
|
+
```
|
|
1893
1935
|
|
|
1894
1936
|
#### Parameters
|
|
1895
1937
|
|
|
@@ -1906,7 +1948,7 @@ iOS:
|
|
|
1906
1948
|
}
|
|
1907
1949
|
}, function(error){
|
|
1908
1950
|
console.error(error);
|
|
1909
|
-
});
|
|
1951
|
+
});
|
|
1910
1952
|
|
|
1911
1953
|
### getBluetoothAuthorizationStatuses()
|
|
1912
1954
|
|
|
@@ -1915,7 +1957,9 @@ Platforms: Android
|
|
|
1915
1957
|
- Returns the individual authorization status for each Bluetooth run-time permission on Android 12+ / API 31+
|
|
1916
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.
|
|
1917
1959
|
|
|
1918
|
-
|
|
1960
|
+
```
|
|
1961
|
+
cordova.plugins.diagnostic.getBluetoothAuthorizationStatuses(successCallback, errorCallback);
|
|
1962
|
+
```
|
|
1919
1963
|
|
|
1920
1964
|
#### Parameters
|
|
1921
1965
|
|
|
@@ -1949,7 +1993,9 @@ Notes for iOS:
|
|
|
1949
1993
|
- When calling this function, the message contained in the `NSBluetoothPeripheralUsageDescription` .plist key is displayed to the user;
|
|
1950
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.
|
|
1951
1995
|
|
|
1952
|
-
|
|
1996
|
+
```
|
|
1997
|
+
cordova.plugins.diagnostic.requestBluetoothAuthorization(successCallback, errorCallback);
|
|
1998
|
+
```
|
|
1953
1999
|
|
|
1954
2000
|
#### Parameters
|
|
1955
2001
|
|
|
@@ -1992,9 +2038,9 @@ The function is passed a single string parameter which indicates the Bluetooth s
|
|
|
1992
2038
|
#### Example usage
|
|
1993
2039
|
|
|
1994
2040
|
cordova.plugins.diagnostic.registerBluetoothStateChangeHandler(function(state){
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2041
|
+
if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){
|
|
2042
|
+
console.log("Bluetooth is able to connect");
|
|
2043
|
+
}
|
|
1998
2044
|
});
|
|
1999
2045
|
|
|
2000
2046
|
|
|
@@ -2150,10 +2196,11 @@ Notes for Android:
|
|
|
2150
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.
|
|
2151
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).
|
|
2152
2198
|
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2199
|
+
```
|
|
2200
|
+
cordova.plugins.diagnostic.isCameraAvailable(params);
|
|
2201
|
+
cordova.plugins.diagnostic.isCameraAvailable(successCallback, errorCallback, params)
|
|
2202
|
+
cordova.plugins.diagnostic.isCameraAvailable(successCallback, errorCallback, externalStorage)
|
|
2203
|
+
```
|
|
2157
2204
|
|
|
2158
2205
|
#### Parameters
|
|
2159
2206
|
- {Object} params - (optional) parameters:
|
|
@@ -2206,10 +2253,11 @@ Notes for Android:
|
|
|
2206
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.
|
|
2207
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).
|
|
2208
2255
|
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2256
|
+
```
|
|
2257
|
+
cordova.plugins.diagnostic.isCameraAuthorized(params);
|
|
2258
|
+
cordova.plugins.diagnostic.isCameraAuthorized(successCallback, errorCallback, params)
|
|
2259
|
+
cordova.plugins.diagnostic.isCameraAuthorized(successCallback, errorCallback, externalStorage)
|
|
2260
|
+
```
|
|
2213
2261
|
|
|
2214
2262
|
#### Parameters
|
|
2215
2263
|
- {Object} params - (optional) parameters:
|
|
@@ -2261,10 +2309,11 @@ Notes for Android:
|
|
|
2261
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.
|
|
2262
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).
|
|
2263
2311
|
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2312
|
+
```
|
|
2313
|
+
cordova.plugins.diagnostic.getCameraAuthorizationStatus(params);
|
|
2314
|
+
cordova.plugins.diagnostic.getCameraAuthorizationStatus(successCallback, errorCallback, params)
|
|
2315
|
+
cordova.plugins.diagnostic.getCameraAuthorizationStatus(successCallback, errorCallback, externalStorage)
|
|
2316
|
+
```
|
|
2268
2317
|
|
|
2269
2318
|
#### Parameters
|
|
2270
2319
|
- {Object} params - (optional) parameters:
|
|
@@ -2330,10 +2379,11 @@ Notes for Android:
|
|
|
2330
2379
|
- Requested run-time permissions which must be added to `AndroidManifest.xml` - see [Android camera permissions](#android-camera-permissions).
|
|
2331
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).
|
|
2332
2381
|
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2382
|
+
```
|
|
2383
|
+
cordova.plugins.diagnostic.requestCameraAuthorization(params);
|
|
2384
|
+
cordova.plugins.diagnostic.requestCameraAuthorization(successCallback, errorCallback, params)
|
|
2385
|
+
cordova.plugins.diagnostic.requestCameraAuthorization(successCallback, errorCallback, externalStorage)
|
|
2386
|
+
```
|
|
2337
2387
|
|
|
2338
2388
|
#### Parameters
|
|
2339
2389
|
|
|
@@ -2755,7 +2805,9 @@ Checks if the application is authorized to use the microphone.
|
|
|
2755
2805
|
Notes for Android:
|
|
2756
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.
|
|
2757
2807
|
|
|
2758
|
-
|
|
2808
|
+
```
|
|
2809
|
+
cordova.plugins.diagnostic.isMicrophoneAuthorized(successCallback, errorCallback);
|
|
2810
|
+
```
|
|
2759
2811
|
|
|
2760
2812
|
#### Parameters
|
|
2761
2813
|
|
|
@@ -2782,8 +2834,9 @@ Returns the microphone authorization status for the application.
|
|
|
2782
2834
|
Notes for Android:
|
|
2783
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.
|
|
2784
2836
|
|
|
2785
|
-
|
|
2786
|
-
|
|
2837
|
+
```
|
|
2838
|
+
cordova.plugins.diagnostic.getMicrophoneAuthorizationStatus(successCallback, errorCallback);
|
|
2839
|
+
```
|
|
2787
2840
|
|
|
2788
2841
|
#### Parameters
|
|
2789
2842
|
|
|
@@ -2817,7 +2870,9 @@ Notes for Android:
|
|
|
2817
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.
|
|
2818
2871
|
- This requests permission for `RECORD_AUDIO` which must be added to `AndroidManifest.xml` - see [Android permissions](#android-permissions).
|
|
2819
2872
|
|
|
2820
|
-
|
|
2873
|
+
```
|
|
2874
|
+
cordova.plugins.diagnostic.requestMicrophoneAuthorization(successCallback, errorCallback);
|
|
2875
|
+
```
|
|
2821
2876
|
|
|
2822
2877
|
#### Parameters
|
|
2823
2878
|
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
@@ -2852,7 +2907,9 @@ Checks if the application is authorized to use contacts (address book).
|
|
|
2852
2907
|
Notes for Android:
|
|
2853
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.
|
|
2854
2909
|
|
|
2855
|
-
|
|
2910
|
+
```
|
|
2911
|
+
cordova.plugins.diagnostic.isContactsAuthorized(successCallback, errorCallback);
|
|
2912
|
+
```
|
|
2856
2913
|
|
|
2857
2914
|
#### Parameters
|
|
2858
2915
|
|
|
@@ -2879,7 +2936,9 @@ Returns the contacts authorization status for the application.
|
|
|
2879
2936
|
Notes for Android:
|
|
2880
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.
|
|
2881
2938
|
|
|
2882
|
-
|
|
2939
|
+
```
|
|
2940
|
+
cordova.plugins.diagnostic.getContactsAuthorizationStatus(successCallback, errorCallback);
|
|
2941
|
+
```
|
|
2883
2942
|
|
|
2884
2943
|
#### Parameters
|
|
2885
2944
|
|
|
@@ -2914,7 +2973,9 @@ Notes for Android:
|
|
|
2914
2973
|
- This requests permission for `READ_CONTACTS` run-time permission
|
|
2915
2974
|
- Required permissions must be added to `AndroidManifest.xml` as appropriate - see [Android permissions](#android-permissions): `READ_CONTACTS, WRITE_CONTACTS, GET_ACCOUNTS`
|
|
2916
2975
|
|
|
2917
|
-
|
|
2976
|
+
```
|
|
2977
|
+
cordova.plugins.diagnostic.requestContactsAuthorization(successCallback, errorCallback);
|
|
2978
|
+
```
|
|
2918
2979
|
|
|
2919
2980
|
#### Parameters
|
|
2920
2981
|
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
@@ -2953,7 +3014,9 @@ Notes for Android:
|
|
|
2953
3014
|
Notes for iOS:
|
|
2954
3015
|
- This relates to Calendar Events (not Calendar Reminders)
|
|
2955
3016
|
|
|
2956
|
-
|
|
3017
|
+
```
|
|
3018
|
+
cordova.plugins.diagnostic.isCalendarAuthorized(successCallback, errorCallback);
|
|
3019
|
+
```
|
|
2957
3020
|
|
|
2958
3021
|
#### Parameters
|
|
2959
3022
|
|
|
@@ -2983,7 +3046,9 @@ Notes for Android:
|
|
|
2983
3046
|
Notes for iOS:
|
|
2984
3047
|
- This relates to Calendar Events (not Calendar Reminders)
|
|
2985
3048
|
|
|
2986
|
-
|
|
3049
|
+
```
|
|
3050
|
+
cordova.plugins.diagnostic.getCalendarAuthorizationStatus(successCallback, errorCallback);
|
|
3051
|
+
```
|
|
2987
3052
|
|
|
2988
3053
|
#### Parameters
|
|
2989
3054
|
|
|
@@ -3019,7 +3084,9 @@ Notes for Android:
|
|
|
3019
3084
|
- This requests permission for `READ_CALENDAR` run-time permission
|
|
3020
3085
|
- Required permissions must be added to `AndroidManifest.xml` as appropriate - see [Android permissions](#android-permissions): `READ_CALENDAR, WRITE_CALENDAR`
|
|
3021
3086
|
|
|
3022
|
-
|
|
3087
|
+
```
|
|
3088
|
+
cordova.plugins.diagnostic.requestCalendarAuthorization(successCallback, errorCallback);
|
|
3089
|
+
```
|
|
3023
3090
|
|
|
3024
3091
|
#### Parameters
|
|
3025
3092
|
- {Function} successCallback - The callback which will be called when operation is successful.
|
|
@@ -3309,11 +3376,11 @@ Defines constants for the various NFC power states.
|
|
|
3309
3376
|
|
|
3310
3377
|
#### Values
|
|
3311
3378
|
|
|
3312
|
-
- `UNKNOWN` -
|
|
3313
|
-
- `POWERED_OFF` -
|
|
3314
|
-
- `POWERED_ON` -
|
|
3315
|
-
- `POWERING_OFF`-
|
|
3316
|
-
- `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
|
|
3317
3384
|
|
|
3318
3385
|
#### Example
|
|
3319
3386
|
|
|
@@ -3374,7 +3441,7 @@ Checks if the device setting for NFC is switched on.
|
|
|
3374
3441
|
|
|
3375
3442
|
Note: this operation **does not** require NFC permission in the manifest.
|
|
3376
3443
|
|
|
3377
|
-
cordova.plugins.diagnostic.
|
|
3444
|
+
cordova.plugins.diagnostic.isNFCEnabled(successCallback, errorCallback);
|
|
3378
3445
|
|
|
3379
3446
|
#### Parameters
|
|
3380
3447
|
|
|
@@ -3469,7 +3536,9 @@ Notes for Android:
|
|
|
3469
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.
|
|
3470
3537
|
- This checks for `READ_EXTERNAL_STORAGE` `CAMERA` run-time permission.
|
|
3471
3538
|
|
|
3472
|
-
|
|
3539
|
+
```
|
|
3540
|
+
cordova.plugins.diagnostic.isExternalStorageAuthorized(successCallback, errorCallback);
|
|
3541
|
+
```
|
|
3473
3542
|
|
|
3474
3543
|
#### Parameters
|
|
3475
3544
|
|
|
@@ -3497,7 +3566,9 @@ Notes for Android:
|
|
|
3497
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.
|
|
3498
3567
|
- This checks for `READ_EXTERNAL_STORAGE` run-time permission.
|
|
3499
3568
|
|
|
3500
|
-
|
|
3569
|
+
```
|
|
3570
|
+
cordova.plugins.diagnostic.getExternalStorageAuthorizationStatus(successCallback, errorCallback);
|
|
3571
|
+
```
|
|
3501
3572
|
|
|
3502
3573
|
#### Parameters
|
|
3503
3574
|
|
|
@@ -3525,7 +3596,9 @@ Requests external storage authorization for the application.
|
|
|
3525
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.
|
|
3526
3597
|
- This requests permission for `READ_EXTERNAL_STORAGE` run-time permission which must be added to `AndroidManifest.xml`.
|
|
3527
3598
|
|
|
3528
|
-
|
|
3599
|
+
```
|
|
3600
|
+
cordova.plugins.diagnostic.requestExternalStorageAuthorization(successCallback, errorCallback);
|
|
3601
|
+
```
|
|
3529
3602
|
|
|
3530
3603
|
#### Parameters
|
|
3531
3604
|
|
|
@@ -3554,34 +3627,36 @@ This differs from the "external directories" returned by [cordova-plugin-file](h
|
|
|
3554
3627
|
|
|
3555
3628
|
For example, on a Samsung Galaxy S4 running Android 7.1.1:
|
|
3556
3629
|
|
|
3557
|
-
|
|
3558
|
-
|
|
3630
|
+
- `cordova.file.externalRootDirectory` returns `file:///storage/emulated/0/`
|
|
3631
|
+
- `cordova.file.externalApplicationStorageDirectory` returns `file:///storage/emulated/0/Android/data/cordova.plugins.diagnostic.example/`
|
|
3559
3632
|
|
|
3560
|
-
|
|
3633
|
+
which are on non-removable internal storage.
|
|
3561
3634
|
|
|
3562
|
-
|
|
3635
|
+
Whereas this method returns:
|
|
3563
3636
|
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
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
|
+
```
|
|
3579
3652
|
|
|
3580
|
-
|
|
3653
|
+
which are on external removable storage.
|
|
3581
3654
|
|
|
3582
3655
|
- Requires permission for `READ_EXTERNAL_STORAGE` run-time permission which must be added to `AndroidManifest.xml`.
|
|
3583
3656
|
|
|
3584
|
-
|
|
3657
|
+
```
|
|
3658
|
+
cordova.plugins.diagnostic.getExternalSdCardDetails(successCallback, errorCallback);
|
|
3659
|
+
```
|
|
3585
3660
|
|
|
3586
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.
|
|
3587
3662
|
|
|
@@ -319,6 +319,19 @@ interface Diagnostic {
|
|
|
319
319
|
errorCallback: (error: string) => void
|
|
320
320
|
) => void;
|
|
321
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
|
+
|
|
322
335
|
/**
|
|
323
336
|
* Returns details of the OS of the device on which the app is currently running
|
|
324
337
|
*
|
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.1.
|
|
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>
|
|
@@ -50,6 +50,7 @@ import android.app.PendingIntent;
|
|
|
50
50
|
import android.content.SharedPreferences;
|
|
51
51
|
import android.content.pm.ApplicationInfo;
|
|
52
52
|
import android.content.pm.PackageInfo;
|
|
53
|
+
import android.net.ConnectivityManager;
|
|
53
54
|
import android.net.Uri;
|
|
54
55
|
import android.os.BatteryManager;
|
|
55
56
|
import android.os.Build;
|
|
@@ -278,6 +279,8 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
278
279
|
callbackContext.success(isADBModeEnabled() ? 1 : 0);
|
|
279
280
|
} else if(action.equals("isDeviceRooted")) {
|
|
280
281
|
callbackContext.success(isDeviceRooted() ? 1 : 0);
|
|
282
|
+
} else if(action.equals("isMobileDataEnabled")) {
|
|
283
|
+
callbackContext.success(isMobileDataEnabled() ? 1 : 0);
|
|
281
284
|
} else if(action.equals("restart")) {
|
|
282
285
|
this.restart(args);
|
|
283
286
|
} else if(action.equals("getArchitecture")) {
|
|
@@ -445,12 +448,27 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
445
448
|
return false;
|
|
446
449
|
}
|
|
447
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
|
+
}
|
|
448
465
|
|
|
449
466
|
/************
|
|
450
467
|
* Internals
|
|
451
468
|
***********/
|
|
452
469
|
|
|
453
470
|
public void logDebug(String msg) {
|
|
471
|
+
if(msg == null) return;
|
|
454
472
|
if(debugEnabled){
|
|
455
473
|
Log.d(TAG, msg);
|
|
456
474
|
executeGlobalJavascript("console.log(\""+TAG+"[native]: "+escapeDoubleQuotes(msg)+"\")");
|
|
@@ -458,6 +476,7 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
458
476
|
}
|
|
459
477
|
|
|
460
478
|
public void logInfo(String msg){
|
|
479
|
+
if(msg == null) return;
|
|
461
480
|
Log.i(TAG, msg);
|
|
462
481
|
if(debugEnabled){
|
|
463
482
|
executeGlobalJavascript("console.info(\""+TAG+"[native]: "+escapeDoubleQuotes(msg)+"\")");
|
|
@@ -465,6 +484,7 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
465
484
|
}
|
|
466
485
|
|
|
467
486
|
public void logWarning(String msg){
|
|
487
|
+
if(msg == null) return;
|
|
468
488
|
Log.w(TAG, msg);
|
|
469
489
|
if(debugEnabled){
|
|
470
490
|
executeGlobalJavascript("console.warn(\""+TAG+"[native]: "+escapeDoubleQuotes(msg)+"\")");
|
|
@@ -472,6 +492,7 @@ public class Diagnostic extends CordovaPlugin{
|
|
|
472
492
|
}
|
|
473
493
|
|
|
474
494
|
public void logError(String msg){
|
|
495
|
+
if(msg == null) return;
|
|
475
496
|
Log.e(TAG, msg);
|
|
476
497
|
if(debugEnabled){
|
|
477
498
|
executeGlobalJavascript("console.error(\""+TAG+"[native]: "+escapeDoubleQuotes(msg)+"\")");
|
package/src/ios/Diagnostic.h
CHANGED
|
@@ -37,6 +37,7 @@ extern NSString*const AUTHORIZATION_LIMITED;
|
|
|
37
37
|
- (void) getCurrentBatteryLevel: (CDVInvokedUrlCommand*)command;
|
|
38
38
|
- (void) getDeviceOSVersion: (CDVInvokedUrlCommand*)command;
|
|
39
39
|
- (void) getBuildOSVersion: (CDVInvokedUrlCommand*)command;
|
|
40
|
+
- (void) isMobileDataEnabled: (CDVInvokedUrlCommand*)command;
|
|
40
41
|
|
|
41
42
|
// Utilities
|
|
42
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
|
|
@@ -212,6 +216,19 @@ static Diagnostic* diagnostic = nil;
|
|
|
212
216
|
}];
|
|
213
217
|
}
|
|
214
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
|
+
|
|
215
232
|
|
|
216
233
|
/********************************/
|
|
217
234
|
#pragma mark - Send results
|
|
@@ -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,22 @@ 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
|
+
|
|
476
492
|
/**
|
|
477
493
|
* Returns details of the OS of the device on which the app is currently running
|
|
478
494
|
*
|
|
@@ -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,22 @@ 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
|
+
|
|
156
172
|
/**
|
|
157
173
|
* Returns details of the OS of the device on which the app is currently running
|
|
158
174
|
*
|