I need to implement network information plugin in an ionic 3 angular 4 project. I have installed a network plugin using
$ ionic cordova plugin add cordova-plugin
Since the release of Ionic 4, Installing Ionic Native for Ionic 3 requires you to add @4
to get the latest compatible version.
In this case, and all others involving Ionic 3, you should do it like this
npm install @ionic-native/network@4
for network,
npm install --save @ionic-native/barcode-scanner@4
for Barcode Scanner,
npm install --save @ionic-native/network@4,
npm install --save @ionic-native/bluetooth-le@4
for BluetoothLE.
The problem is that you are using the /ngx
import which is for Ionic version 4. If you go read the changelog you will see that version 5 and up Requires Angular 7.1 and TypeScript 3.1
.
Try to downgrade plugin to 4.20.0 like this :
npm uninstall @ionic-native/network
then
npm install @ionic-native/network@4.20.0
And remove ngx in import like this :
import { Network } from '@ionic-native/network';