index.d.ts 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  1. import { AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core';
  2. /**
  3. * @name Diagnostic
  4. * @description
  5. * Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
  6. * @usage
  7. * ```typescript
  8. * import { Diagnostic } from '@awesome-cordova-plugins/diagnostic/ngx';
  9. *
  10. * constructor(private diagnostic: Diagnostic) { }
  11. *
  12. * ...
  13. *
  14. * let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); }
  15. * let errorCallback = (e) => console.error(e);
  16. *
  17. * this.diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
  18. *
  19. * this.diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
  20. *
  21. *
  22. * this.diagnostic.getBluetoothState()
  23. * .then((state) => {
  24. * if (state == this.diagnostic.bluetoothState.POWERED_ON){
  25. * // do something
  26. * } else {
  27. * // do something else
  28. * }
  29. * }).catch(e => console.error(e));
  30. *
  31. * ```
  32. */
  33. export declare class Diagnostic extends AwesomeCordovaNativePlugin {
  34. permission: {
  35. ACCEPT_HANDOVER: string;
  36. ACCESS_BACKGROUND_LOCATION: string;
  37. ACCESS_COARSE_LOCATION: string;
  38. ACCESS_FINE_LOCATION: string;
  39. ACCESS_MEDIA_LOCATION: string;
  40. ACTIVITY_RECOGNITION: string;
  41. ADD_VOICEMAIL: string;
  42. ANSWER_PHONE_CALLS: string;
  43. BLUETOOTH_ADVERTISE: string;
  44. BLUETOOTH_CONNECT: string;
  45. BLUETOOTH_SCAN: string;
  46. BODY_SENSORS: string;
  47. BODY_SENSORS_BACKGROUND: string;
  48. CALL_PHONE: string;
  49. CAMERA: string;
  50. GET_ACCOUNTS: string;
  51. NEARBY_WIFI_DEVICES: string;
  52. POST_NOTIFICATIONS: string;
  53. PROCESS_OUTGOING_CALLS: string;
  54. READ_CALENDAR: string;
  55. READ_CALL_LOG: string;
  56. READ_CONTACTS: string;
  57. READ_EXTERNAL_STORAGE: string;
  58. READ_MEDIA_AUDIO: string;
  59. READ_MEDIA_IMAGES: string;
  60. READ_MEDIA_VIDEO: string;
  61. READ_PHONE_NUMBERS: string;
  62. READ_PHONE_STATE: string;
  63. READ_SMS: string;
  64. RECEIVE_MMS: string;
  65. RECEIVE_SMS: string;
  66. RECEIVE_WAP_PUSH: string;
  67. RECORD_AUDIO: string;
  68. SEND_SMS: string;
  69. USE_SIP: string;
  70. UWB_RANGING: string;
  71. WRITE_CALENDAR: string;
  72. WRITE_CALL_LOG: string;
  73. WRITE_CONTACTS: string;
  74. WRITE_EXTERNAL_STORAGE: string;
  75. };
  76. permissionStatus: {
  77. GRANTED: string;
  78. /**
  79. * @deprecated cordova.plugins.diagnostic@5.0.0 uses DENIED_ONCE to unify DENIED* statuses across iOS/Android
  80. */
  81. DENIED: string;
  82. DENIED_ONCE: string;
  83. NOT_REQUESTED: string;
  84. DENIED_ALWAYS: string;
  85. RESTRICTED: string;
  86. GRANTED_WHEN_IN_USE: string;
  87. EPHEMERAL: string;
  88. PROVISIONAL: string;
  89. LIMITED: string;
  90. };
  91. locationAuthorizationMode: {
  92. ALWAYS: string;
  93. WHEN_IN_USE: string;
  94. };
  95. /**
  96. * Location accuracy authorization
  97. */
  98. locationAccuracyAuthorization: {
  99. FULL: string;
  100. REDUCED: string;
  101. };
  102. permissionGroups: {
  103. CALENDAR: string[];
  104. CAMERA: string[];
  105. CONTACTS: string[];
  106. LOCATION: string[];
  107. MICROPHONE: string[];
  108. PHONE: string[];
  109. SENSORS: string[];
  110. SMS: string[];
  111. STORAGE: string[];
  112. NEARBY_DEVICES: string[];
  113. };
  114. locationMode: {
  115. HIGH_ACCURACY: string;
  116. DEVICE_ONLY: string;
  117. BATTERY_SAVING: string;
  118. LOCATION_OFF: string;
  119. };
  120. bluetoothState: {
  121. UNKNOWN: string;
  122. RESETTING: string;
  123. UNSUPPORTED: string;
  124. UNAUTHORIZED: string;
  125. POWERED_OFF: string;
  126. POWERED_ON: string;
  127. POWERING_OFF: string;
  128. POWERING_ON: string;
  129. };
  130. NFCState: {
  131. UNKNOWN: string;
  132. POWERED_OFF: string;
  133. POWERED_ON: string;
  134. POWERING_ON: string;
  135. POWERING_OFF: string;
  136. };
  137. cpuArchitecture: {
  138. MIPS: string;
  139. MIPS_64: string;
  140. UNKNOWN: string;
  141. ARMv6: string;
  142. ARMv7: string;
  143. ARMv8: string;
  144. X86: string;
  145. X86_64: string;
  146. };
  147. remoteNotificationType: {
  148. ALERT: string;
  149. SOUND: string;
  150. BADGE: string;
  151. };
  152. motionStatus: {
  153. NOT_REQUESTED: string;
  154. GRANTED: string;
  155. DENIED: string;
  156. RESTRICTED: string;
  157. NOT_AVAILABLE: string;
  158. NOT_DETERMINED: string;
  159. UNKNOWN: string;
  160. };
  161. /**
  162. * Access to the photo library (iOS 14+)
  163. *
  164. * ADD_ONLY - can add to but not read from Photo Library
  165. * READ_WRITE - can both add to and read from Photo Library
  166. *
  167. */
  168. photoLibraryAccessLevel: {
  169. ADD_ONLY: string;
  170. READ_WRITE: string;
  171. };
  172. /**
  173. * Checks if app is able to access device location.
  174. *
  175. * @returns {Promise<any>}
  176. */
  177. isLocationAvailable(): Promise<any>;
  178. /**
  179. * Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
  180. * On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
  181. *
  182. * @returns {Promise<any>}
  183. */
  184. isWifiAvailable(): Promise<any>;
  185. /**
  186. * Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
  187. * application is authorized to use it.
  188. *
  189. * @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
  190. * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
  191. * @returns {Promise<any>}
  192. */
  193. isCameraAvailable(externalStorage?: boolean): Promise<any>;
  194. /**
  195. * Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
  196. * On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
  197. *
  198. * @returns {Promise<any>}
  199. */
  200. isBluetoothAvailable(): Promise<any>;
  201. /**
  202. * Displays the device location settings to allow user to enable location services/change location mode.
  203. */
  204. switchToLocationSettings(): void;
  205. /**
  206. * Displays mobile settings to allow user to enable mobile data.
  207. */
  208. switchToMobileDataSettings(): void;
  209. /**
  210. * Displays Bluetooth settings to allow user to enable Bluetooth.
  211. */
  212. switchToBluetoothSettings(): void;
  213. /**
  214. * Displays WiFi settings to allow user to enable WiFi.
  215. */
  216. switchToWifiSettings(): void;
  217. /**
  218. * Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
  219. *
  220. * @returns {Promise<boolean>}
  221. */
  222. isWifiEnabled(): Promise<boolean>;
  223. /**
  224. * Enables/disables WiFi on the device.
  225. * Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
  226. *
  227. * @param {boolean} state
  228. * @returns {Promise<any>}
  229. */
  230. setWifiState(state: boolean): Promise<any>;
  231. /**
  232. * Enables/disables Bluetooth on the device.
  233. * Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
  234. *
  235. * @param {boolean} state
  236. * @returns {Promise<any>}
  237. */
  238. setBluetoothState(state: boolean): Promise<any>;
  239. /**
  240. * Enables debug mode, which logs native plugin debug messages to the native and JS consoles.
  241. * Debug mode is initially disabled on plugin initialisation.
  242. */
  243. enableDebug(): Promise<void>;
  244. /**
  245. * Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on.
  246. *
  247. * @returns {Promise<boolean>}
  248. */
  249. isLocationEnabled(): Promise<boolean>;
  250. /**
  251. * Checks if the application is authorized to use location.
  252. * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
  253. *
  254. * @returns {Promise<any>}
  255. */
  256. isLocationAuthorized(): Promise<any>;
  257. /**
  258. * Returns the location authorization status for the application.
  259. *
  260. * @returns {Promise<any>}
  261. */
  262. getLocationAuthorizationStatus(): Promise<any>;
  263. /**
  264. * Returns the individual location authorization status for each type of location access (FINE, COARSE and BACKGROUND).
  265. *
  266. * @returns {Promise<any>}
  267. */
  268. getLocationAuthorizationStatuses(): Promise<any>;
  269. /**
  270. * Returns the location authorization status for the application.
  271. * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
  272. *
  273. * @param {string} [mode] location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". (this.locationAuthorizationMode)
  274. * @param {string} [accuracy] requested location accuracy: "full" or "reduced". If not specified, defaults to "full". (this.locationAccuracyAuthorization)
  275. * @returns {Promise<any>}
  276. */
  277. requestLocationAuthorization(mode?: string, accuracy?: string): Promise<any>;
  278. /**
  279. * Checks if camera hardware is present on device.
  280. *
  281. * @returns {Promise<any>}
  282. */
  283. isCameraPresent(): Promise<any>;
  284. /**
  285. * Checks if the application is authorized to use the camera.
  286. * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
  287. *
  288. * @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
  289. * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
  290. * @returns {Promise<any>}
  291. */
  292. isCameraAuthorized(externalStorage?: boolean): Promise<any>;
  293. /**
  294. * Returns the camera authorization status for the application.
  295. *
  296. * @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
  297. * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
  298. * @returns {Promise<any>}
  299. */
  300. getCameraAuthorizationStatus(externalStorage?: boolean): Promise<any>;
  301. /**
  302. * Requests camera authorization for the application.
  303. *
  304. * @param {boolean} [externalStorage] Android only: If true, requests permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
  305. * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
  306. * @returns {Promise<any>}
  307. */
  308. requestCameraAuthorization(externalStorage?: boolean): Promise<any>;
  309. /**
  310. * Checks if the application is authorized to use the microphone.
  311. *
  312. * @returns {Promise<boolean>}
  313. */
  314. isMicrophoneAuthorized(): Promise<boolean>;
  315. /**
  316. * Returns the microphone authorization status for the application.
  317. *
  318. * @returns {Promise<any>}
  319. */
  320. getMicrophoneAuthorizationStatus(): Promise<any>;
  321. /**
  322. * Requests microphone authorization for the application.
  323. *
  324. * @returns {Promise<any>}
  325. */
  326. requestMicrophoneAuthorization(): Promise<any>;
  327. /**
  328. * Checks if the application is authorized to use contacts (address book).
  329. *
  330. * @returns {Promise<boolean>}
  331. */
  332. isContactsAuthorized(): Promise<boolean>;
  333. /**
  334. * Returns the contacts authorization status for the application.
  335. *
  336. * @returns {Promise<any>}
  337. */
  338. getContactsAuthorizationStatus(): Promise<any>;
  339. /**
  340. * Requests contacts authorization for the application.
  341. *
  342. * @returns {Promise<any>}
  343. */
  344. requestContactsAuthorization(): Promise<any>;
  345. /**
  346. * Checks if the application is authorized to use the calendar.
  347. *
  348. * Notes for Android:
  349. * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
  350. *
  351. * Notes for iOS:
  352. * - This relates to Calendar Events (not Calendar Reminders)
  353. *
  354. * @returns {Promise<boolean>}
  355. */
  356. isCalendarAuthorized(): Promise<boolean>;
  357. /**
  358. * Returns the calendar authorization status for the application.
  359. *
  360. * Notes for Android:
  361. * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return `GRANTED` status as permissions are already granted at installation time.
  362. *
  363. * Notes for iOS:
  364. * - This relates to Calendar Events (not Calendar Reminders)
  365. *
  366. * @returns {Promise<any>}
  367. */
  368. getCalendarAuthorizationStatus(): Promise<any>;
  369. /**
  370. * Requests calendar authorization for the application.
  371. *
  372. * Notes for iOS:
  373. * - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status.
  374. * - This relates to Calendar Events (not Calendar Reminders)
  375. *
  376. * Notes for Android:
  377. * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
  378. * - This requests permission for `READ_CALENDAR` run-time permission
  379. * - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR`
  380. *
  381. * @returns {Promise<any>}
  382. */
  383. requestCalendarAuthorization(): Promise<any>;
  384. /**
  385. * Opens settings page for this app.
  386. * On Android, this opens the "App Info" page in the Settings app.
  387. * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
  388. *
  389. * @returns {Promise<any>}
  390. */
  391. switchToSettings(): Promise<any>;
  392. /**
  393. * Returns the state of Bluetooth on the device.
  394. *
  395. * @returns {Promise<any>}
  396. */
  397. getBluetoothState(): Promise<any>;
  398. /**
  399. * Registers a function to be called when a change in Bluetooth state occurs.
  400. *
  401. * @param {Function} handler
  402. */
  403. registerBluetoothStateChangeHandler(handler: Function): void;
  404. /**
  405. * Registers a function to be called when a change in Location state occurs.
  406. *
  407. * @param {Function} handler
  408. */
  409. registerLocationStateChangeHandler(handler: Function): void;
  410. /**
  411. * Returns CPU architecture of the current device.
  412. *
  413. * @returns {Promise<any>}
  414. */
  415. getArchitecture(): Promise<any>;
  416. /**
  417. * Returns the current battery level of the device as a percentage.
  418. *
  419. * @returns {Promise<any>}
  420. */
  421. getCurrentBatteryLevel(): Promise<any>;
  422. /**
  423. * Restarts the application.
  424. * By default, a "warm" restart will be performed in which the main Cordova activity is immediately restarted, causing the Webview instance to be recreated.
  425. * However, if the `cold` parameter is set to true, then the application will be "cold" restarted, meaning a system exit will be performed, causing the entire application to be restarted.
  426. * This is useful if you want to fully reset the native application state but will cause the application to briefly disappear and re-appear..
  427. *
  428. * @returns {Promise<any>}
  429. */
  430. restart(cold: boolean): Promise<any>;
  431. /**
  432. * Checks if high-accuracy locations are available to the app from GPS hardware.
  433. * Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorized to use location.
  434. *
  435. * @returns {Promise<boolean>}
  436. */
  437. isGpsLocationAvailable(): Promise<boolean>;
  438. /**
  439. * Checks if location mode is set to return high-accuracy locations from GPS hardware.
  440. * Returns true if Location mode is enabled and is set to either:
  441. * - Device only = GPS hardware only (high accuracy)
  442. * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
  443. *
  444. * @returns {Promise<any>}
  445. */
  446. isGpsLocationEnabled(): Promise<any>;
  447. /**
  448. * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
  449. * Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorized to use location.
  450. *
  451. * @returns {Promise<any>}
  452. */
  453. isNetworkLocationAvailable(): Promise<any>;
  454. /**
  455. * Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
  456. * Returns true if Location mode is enabled and is set to either:
  457. * - Battery saving = network triangulation and Wifi network IDs (low accuracy)
  458. * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
  459. *
  460. * @returns {Promise<any>}
  461. */
  462. isNetworkLocationEnabled(): Promise<any>;
  463. /**
  464. * Checks if airplane mode is enabled on device.
  465. *
  466. * @returns {Promise<any>}
  467. */
  468. isAirplaneModeEnabled(): Promise<any>;
  469. /**
  470. * Checks if mobile data is enabled on device.
  471. *
  472. * @returns {Promise<any>}
  473. */
  474. isMobileDataEnabled(): Promise<any>;
  475. /**
  476. * Returns the current location mode setting for the device.
  477. *
  478. * @returns {Promise<any>}
  479. */
  480. getLocationMode(): Promise<any>;
  481. /**
  482. * Returns details of the OS of the device on which the app is currently running
  483. *
  484. * @returns {Promise<any>}
  485. */
  486. getDeviceOSVersion(): Promise<any>;
  487. /**
  488. * Returns details of the SDK levels used to build the app.
  489. *
  490. * @returns {Promise<any>}
  491. */
  492. getBuildOSVersion(): Promise<any>;
  493. /**
  494. * Returns the current authorization status for a given permission.
  495. * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
  496. *
  497. * @param permission
  498. * @returns {Promise<any>}
  499. */
  500. getPermissionAuthorizationStatus(permission: any): Promise<any>;
  501. /**
  502. * Returns the current authorization status for multiple permissions.
  503. * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
  504. *
  505. * @param {any[]} permissions
  506. * @returns {Promise<any>}
  507. */
  508. getPermissionsAuthorizationStatus(permissions: any[]): Promise<any>;
  509. /**
  510. * Requests app to be granted authorization for a runtime permission.
  511. * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
  512. *
  513. * @param permission
  514. * @returns {Promise<any>}
  515. */
  516. requestRuntimePermission(permission: any): Promise<any>;
  517. /**
  518. * Requests app to be granted authorization for multiple runtime permissions.
  519. * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
  520. *
  521. * @param {any[]} permissions
  522. * @returns {Promise<any>}
  523. */
  524. requestRuntimePermissions(permissions: any[]): Promise<any>;
  525. /**
  526. * Indicates if the plugin is currently requesting a runtime permission via the native API.
  527. * Note that only one request can be made concurrently because the native API cannot handle concurrent requests,
  528. * so the plugin will invoke the error callback if attempting to make more than one simultaneous request.
  529. * Multiple permission requests should be grouped into a single call since the native API is setup to handle batch requests of multiple permission groups.
  530. *
  531. * @returns {boolean}
  532. */
  533. isRequestingPermission(): boolean;
  534. /**
  535. * Registers a function to be called when a runtime permission request has completed.
  536. * Pass in a falsy value to de-register the currently registered function.
  537. *
  538. * @param {Function} handler
  539. */
  540. registerPermissionRequestCompleteHandler(handler: Function): void;
  541. /**
  542. * Checks if the device setting for Bluetooth is switched on.
  543. * This requires `BLUETOOTH` permission on Android
  544. *
  545. * @returns {Promise<boolean>}
  546. */
  547. isBluetoothEnabled(): Promise<boolean>;
  548. /**
  549. * Checks if the device has Bluetooth capabilities.
  550. *
  551. * @returns {Promise<boolean>}
  552. */
  553. hasBluetoothSupport(): Promise<boolean>;
  554. /**
  555. * Checks if the device has Bluetooth Low Energy (LE) capabilities.
  556. *
  557. * @returns {Promise<boolean>}
  558. */
  559. hasBluetoothLESupport(): Promise<boolean>;
  560. /**
  561. * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
  562. *
  563. * @returns {Promise<boolean>}
  564. */
  565. hasBluetoothLEPeripheralSupport(): Promise<boolean>;
  566. /**
  567. * Returns the Bluetooth authorization status of the application on the device.
  568. *
  569. * @returns {Promise<any>}
  570. */
  571. getBluetoothAuthorizationStatus(): Promise<any>;
  572. /**
  573. * Returns the individual authorization status for each Bluetooth run-time permission on Android 12+ / API 31+
  574. * 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.
  575. *
  576. * @returns {Promise<any>}
  577. */
  578. getBluetoothAuthorizationStatuses(): Promise<any>;
  579. /**
  580. * Checks if the application is authorized to use external storage.
  581. *
  582. * @returns {Promise<boolean>}
  583. */
  584. isExternalStorageAuthorized(): Promise<boolean>;
  585. /**
  586. * CReturns the external storage authorization status for the application.
  587. *
  588. * @returns {Promise<boolean>}
  589. */
  590. getExternalStorageAuthorizationStatus(): Promise<any>;
  591. /**
  592. * Requests external storage authorization for the application.
  593. *
  594. * @returns {Promise<any>}
  595. */
  596. requestExternalStorageAuthorization(): Promise<any>;
  597. /**
  598. * Returns details of external SD card(s): absolute path, is writable, free space.
  599. *
  600. * The intention of this method is to return the location and details of removable external SD cards.
  601. * This differs from the "external directories" returned by cordova-plugin-file which return mount points relating to non-removable (internal) storage.
  602. *
  603. * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getexternalsdcarddetails)
  604. *
  605. * @returns {Promise<any>}
  606. */
  607. getExternalSdCardDetails(): Promise<any>;
  608. /**
  609. * Switches to the wireless settings page in the Settings app. Allows configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.
  610. */
  611. switchToWirelessSettings(): void;
  612. /**
  613. * Displays NFC settings to allow user to enable NFC.
  614. */
  615. switchToNFCSettings(): void;
  616. /**
  617. * Checks if NFC hardware is present on device.
  618. *
  619. * @returns {Promise<boolean>}
  620. */
  621. isNFCPresent(): Promise<boolean>;
  622. /**
  623. * Checks if the device setting for NFC is switched on.
  624. * Note: this operation does not require NFC permission in the manifest.
  625. *
  626. * @returns {Promise<boolean>}
  627. */
  628. isNFCEnabled(): Promise<boolean>;
  629. /**
  630. * Checks if NFC is available to the app. Returns true if the device has NFC capabilities AND if NFC setting is switched on.
  631. * Note: this operation does not require NFC permission in the manifest.
  632. *
  633. * @returns {Promise<any>}
  634. */
  635. isNFCAvailable(): Promise<boolean>;
  636. /**
  637. * Registers a function to be called when a change in NFC state occurs. Pass in a falsy value to de-register the currently registered function.
  638. *
  639. * @param {Function} hander callback function to be called when NFC state changes
  640. * @param handler
  641. * @returns {Promise<any>}
  642. */
  643. registerNFCStateChangeHandler(handler: Function): void;
  644. /**
  645. * Checks if the device data roaming setting is enabled.
  646. *
  647. * @returns {Promise<boolean>}
  648. */
  649. isDataRoamingEnabled(): Promise<boolean>;
  650. /**
  651. * Checks if the device setting for ADB(debug) is switched on.
  652. *
  653. * @returns {Promise<boolean>}
  654. */
  655. isADBModeEnabled(): Promise<boolean>;
  656. /**
  657. * Checks if the device is rooted.
  658. *
  659. * @returns {Promise<boolean>}
  660. */
  661. isDeviceRooted(): Promise<boolean>;
  662. /**
  663. * Checks if the application is authorized to use the Camera Roll in Photos app.
  664. *
  665. * @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
  666. * Possible values are:
  667. * ADD_ONLY - can add to but not read from Photo Library
  668. * READ_WRITE - can both add to and read from Photo Library
  669. * Defaults to ADD_ONLY if not specified
  670. * Has no effect on iOS 13 or below
  671. *
  672. * @returns {Promise<boolean>}
  673. */
  674. isCameraRollAuthorized(accessLevel?: string): Promise<boolean>;
  675. /**
  676. * Returns the authorization status for the application to use the Camera Roll in Photos app.
  677. *
  678. * @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
  679. * Possible values are:
  680. * ADD_ONLY - can add to but not read from Photo Library
  681. * READ_WRITE - can both add to and read from Photo Library
  682. * Defaults to ADD_ONLY if not specified
  683. * Has no effect on iOS 13 or below
  684. *
  685. * @returns {Promise<string>}
  686. */
  687. getCameraRollAuthorizationStatus(accessLevel?: string): Promise<string>;
  688. /**
  689. * Requests camera roll authorization for the application.
  690. * Should only be called if authorization status is NOT_REQUESTED.
  691. * Calling it when in any other state will have no effect.
  692. *
  693. * @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
  694. * Possible values are:
  695. * ADD_ONLY - can add to but not read from Photo Library
  696. * READ_WRITE - can both add to and read from Photo Library
  697. * Defaults to ADD_ONLY if not specified
  698. * Has no effect on iOS 13 or below
  699. *
  700. * @returns {Promise<any>}
  701. */
  702. requestCameraRollAuthorization(accessLevel?: string): Promise<any>;
  703. /**
  704. * Presents limited library picker UI on iOS 14+
  705. *
  706. * @returns {Promise<any>}
  707. */
  708. presentLimitedLibraryPicker(): Promise<any>;
  709. /**
  710. * Checks if remote (push) notifications are enabled.
  711. *
  712. * @returns {Promise<boolean>}
  713. */
  714. isRemoteNotificationsEnabled(): Promise<boolean>;
  715. /**
  716. * Indicates if the app is registered for remote (push) notifications on the device.
  717. *
  718. * @returns {Promise<boolean>}
  719. */
  720. isRegisteredForRemoteNotifications(): Promise<boolean>;
  721. /**
  722. * Returns the authorization status for the application to use Remote Notifications.
  723. * Note: Works on iOS 10+ only (iOS 9 and below will invoke the error callback).
  724. *
  725. * @returns {Promise<string>}
  726. */
  727. getRemoteNotificationsAuthorizationStatus(): Promise<string>;
  728. /**
  729. * Requests reminders authorization for the application.
  730. *
  731. * @param types
  732. * @param omitRegistration
  733. * @returns {Promise<any>}
  734. */
  735. requestRemoteNotificationsAuthorization(types?: string[], omitRegistration?: boolean): Promise<string>;
  736. /**
  737. * Indicates the current setting of notification types for the app in the Settings app.
  738. * Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled.
  739. *
  740. * @returns {Promise<any>}
  741. */
  742. getRemoteNotificationTypes(): Promise<any>;
  743. /**
  744. * Checks if the application is authorized to use reminders.
  745. *
  746. * @returns {Promise<boolean>}
  747. */
  748. isRemindersAuthorized(): Promise<boolean>;
  749. /**
  750. * Returns the reminders authorization status for the application.
  751. *
  752. * @returns {Promise<any>}
  753. */
  754. getRemindersAuthorizationStatus(): Promise<any>;
  755. /**
  756. * Requests reminders authorization for the application.
  757. *
  758. * @returns {Promise<any>}
  759. */
  760. requestRemindersAuthorization(): Promise<any>;
  761. /**
  762. * Checks if the application is authorized for background refresh.
  763. *
  764. * @returns {Promise<boolean>}
  765. */
  766. isBackgroundRefreshAuthorized(): Promise<boolean>;
  767. /**
  768. * Returns the background refresh authorization status for the application.
  769. *
  770. * @returns {Promise<any>}
  771. */
  772. getBackgroundRefreshStatus(): Promise<any>;
  773. /**
  774. * Requests Bluetooth authorization for the application.
  775. *
  776. * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestbluetoothauthorization)
  777. *
  778. * @returns {Promise<any>}
  779. */
  780. requestBluetoothAuthorization(): Promise<any>;
  781. /**
  782. * Checks if motion tracking is available on the current device.
  783. *
  784. * @returns {Promise<boolean>}
  785. */
  786. isMotionAvailable(): Promise<boolean>;
  787. /**
  788. * Checks if it's possible to determine the outcome of a motion authorization request on the current device.
  789. * There's no direct way to determine if authorization was granted or denied, so the Pedometer API must be used to indirectly determine this:
  790. * therefore, if the device supports motion tracking but not Pedometer Event Tracking, the outcome of requesting motion detection cannot be determined.
  791. *
  792. * @returns {Promise<boolean>}
  793. */
  794. isMotionRequestOutcomeAvailable(): Promise<boolean>;
  795. /**
  796. * Requests motion tracking authorization for the application.
  797. *
  798. * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestmotionauthorization)
  799. *
  800. * @returns {Promise<string>}
  801. */
  802. requestMotionAuthorization(): Promise<string>;
  803. /**
  804. * Checks motion authorization status for the application.
  805. *
  806. * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getmotionauthorizationstatus)
  807. *
  808. * @returns {Promise<string>}
  809. */
  810. getMotionAuthorizationStatus(): Promise<string>;
  811. /**
  812. * Returns the location accuracy authorization for the application on iOS 14+ and Android 12+. Note: calling on iOS <14 or Android <12 will always return cordova.plugins.diagnostic.locationAccuracyAuthorization.FULL
  813. *
  814. * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getlocationaccuracyauthorization)
  815. *
  816. * @returns {Promise<string>}
  817. */
  818. getLocationAccuracyAuthorization(): Promise<string>;
  819. /**
  820. * Requests temporary access to full location accuracy for the application on iOS 14+.
  821. *
  822. * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requesttemporaryfullaccuracyauthorization)
  823. *
  824. * @param purpose
  825. * @returns {Promise<string>}
  826. */
  827. requestTemporaryFullAccuracyAuthorization(purpose: string): Promise<string>;
  828. /**
  829. * Registers a function to be called when a change in location accuracy authorization occurs on iOS 14+.
  830. *
  831. * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#registerLocationAccuracyAuthorizationChangeHandler)
  832. *
  833. * @param handler
  834. */
  835. registerLocationAccuracyAuthorizationChangeHandler(handler: Function): void;
  836. }