Diagnostic not working

Hi all,

I am working on an app and would like to check if Bluetooth is on before trying to collect data. Now I tried using the ionic diagnostic plugin as given here. And added the usual this to the app.module.ts:

import { Diagnostic } from '@ionic-native/diagnostic/ngx';
providers: [

The plugin is installed and shows after running the ionic cordova list command. But in-app it keeps on running into the Uncaught (in promise): TypeError: object is not a function TypeError: object is not a function at Diagnostic.BluetoothAvailable

I am calling the following function from a provider in a different provider:

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Diagnostic } from '@ionic-native/diagnostic/ngx';
import { Platform } from 'ionic-angular';

  Generated class for the DiagnosticProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
export class DiagnosticProvider {

        public http: HttpClient,
        private diagnostic: Diagnostic,
        private platform: Platform,
    ) {
            console.log('Hello DiagnosticProvider Provider');
    public checkBluetooth() {
        console.log("in checkBluetooth");
        this.platform.ready().then(() =>{
            let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); }
            let errorCallback = (e) => console.error(e);


   ionic (Ionic CLI)  : 4.10.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.10


   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 9 other plugins)


   Android SDK Tools : 26.1.1 (/home/thomas/Android/Sdk)
   NodeJS            : v8.11.4 (/usr/bin/node)
   npm               : 5.8.0
   OS                : Linux 4.18

Also, I tried ionic repair and removing all node_modules and reinstalling them.

Any ideas on how to tackle this

hello, did you fix this? i have the same issue

Hey any updates on this? Im facing the same issue. I also tried with isLocationEnable() and requestLocationAuthorization() and still gettin the same error.

Unfortunately it has been to long for me to remember completely. But the error was solved after downgrading a non packages. I would now say diagnostic itself but like I said I’m not completely sure.

@theetje What version of diagnostic are you running for your Ionic 3 App? I have installed the latest version and it doesn’t work on Android emulator, the version I have needs “/ngx” on the end when importing it and I have had issues before with “/ngx” versions of plugins showing a similar error, I am struggling to find which version is the latest one that is not “/ngx”

I don’t think it’s a good idea to look backwards like this. Instead, ensure that all your @ionic-native/* dependencies share the same (current) major version.

@rapropos Can you confirm that the “current” versions of the plugins (the ones that require “/ngx”) work on Ionic 3 though, everytime I have tried them I always get the same error as follows:

Object(...) is not a function

Not directly, but I can tell you that:

…is caused by not doing this:

@rapropos Okay, so the issue is that I have a mixture of version 4 and version 5 of the plugins in my App? If this is the case I will bear this in mind for when I do decide to update them that I must update all of them at the same time to the latest version, unfortunately where this is a production App I haven’t got the time or resources at the moment to upgrade them all and test everything is working because I need to get a new version of the App released in the knowledge that I am not going to be breaking anything for my customers.

I can confirm that I have resolved the problem by downgrading the diagnostic plugin to version 4 by running the following:

ionic cordova plugin rm cordova.plugins.diagnostic
npm rm @ionic-native/diagnostic
ionic cordova plugin add cordova.plugins.diagnostic@4
npm install @ionic-native/diagnostic@4

Yes, that’s exactly what I would say more concisely if Discourse didn’t have a character minimum.