Skip to main content
Version: v5

Diagnostic

Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi

github.com/dpa99c/cordova-diagnostic-plugin

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation

$ npm install cordova.plugins.diagnostic $ npm install @awesome-cordova-plugins/diagnostic $ ionic cap sync

Supported Platforms

  • Android
  • iOS
  • Windows

Usage

React

Learn more about using Ionic Native components in React

Angular

import { Diagnostic } from '@awesome-cordova-plugins/diagnostic/ngx';

constructor(private diagnostic: Diagnostic) { }

...

let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); }
let errorCallback = (e) => console.error(e);

this.diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);

this.diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);


this.diagnostic.getBluetoothState()
.then((state) => {
if (state == this.diagnostic.bluetoothState.POWERED_ON){
// do something
} else {
// do something else
}
}).catch(e => console.error(e));