Skip to content

Commit

Permalink
fix(ibeacon): undefined locationManager (#3505)
Browse files Browse the repository at this point in the history
Change some cordova.plugins calls to window.cordova.plugins to
prevent 'Cannot read property 'locationManager' of undefined'
  • Loading branch information
Stefanic authored Aug 14, 2020
1 parent 44f86f3 commit 1ffad79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/@ionic-native/plugins/ibeacon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class IBeacon extends IonicNativePlugin {
*/
@CordovaCheck({ sync: true })
Delegate(): IBeaconDelegate {
const delegate = new cordova.plugins.locationManager.Delegate();
const delegate = new window.cordova.plugins.locationManager.Delegate();

delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>((observer: any) => {
Expand Down Expand Up @@ -358,7 +358,7 @@ export class IBeacon extends IonicNativePlugin {
});
};

cordova.plugins.locationManager.setDelegate(delegate);
window.cordova.plugins.locationManager.setDelegate(delegate);
return delegate;
}

Expand All @@ -382,7 +382,7 @@ export class IBeacon extends IonicNativePlugin {
minor?: number,
notifyEntryStateOnDisplay?: boolean
): BeaconRegion {
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
return new window.cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
}

/**
Expand Down

0 comments on commit 1ffad79

Please sign in to comment.