Hi! I was trying to make my connectivity provider then I got the error above. Could someone help? Thanks in advance. here is the code:
import { Injectable } from '@angular/core';
import { Network } from 'ionic-native';
import { Platform } from 'ionic-angular';
import { Observable } from 'rxjs/Observable';
declare var Connection;
@Injectable()
export class Connectivity {
onDevice: boolean;
constructor(public platform: Platform){
this.onDevice = this.platform.is('cordova');
}
isOnline(): boolean {
if(this.onDevice && Network.type){
return Network.type != 'none';
} else {
return navigator.onLine;
}
}
isOffline(): boolean {
if(this.onDevice && Network.type){
return Network.type == 'none';
} else {
return !navigator.onLine;
}
}
watchOnline(): Observable<any> {
return Network.onConnect();
}
watchOffline(): Observable<any> {
return Network.onDisconnect();
}
}