Skip to content

Commit 1ffad79

Browse files
authored
fix(ibeacon): undefined locationManager (#3505)
Change some cordova.plugins calls to window.cordova.plugins to prevent 'Cannot read property 'locationManager' of undefined'
1 parent 44f86f3 commit 1ffad79

File tree

1 file changed

+3
-3
lines changed
  • src/@ionic-native/plugins/ibeacon

1 file changed

+3
-3
lines changed

src/@ionic-native/plugins/ibeacon/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export class IBeacon extends IonicNativePlugin {
293293
*/
294294
@CordovaCheck({ sync: true })
295295
Delegate(): IBeaconDelegate {
296-
const delegate = new cordova.plugins.locationManager.Delegate();
296+
const delegate = new window.cordova.plugins.locationManager.Delegate();
297297

298298
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
299299
return new Observable<IBeaconPluginResult>((observer: any) => {
@@ -358,7 +358,7 @@ export class IBeacon extends IonicNativePlugin {
358358
});
359359
};
360360

361-
cordova.plugins.locationManager.setDelegate(delegate);
361+
window.cordova.plugins.locationManager.setDelegate(delegate);
362362
return delegate;
363363
}
364364

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

388388
/**

0 commit comments

Comments
 (0)