cordova-plugin-ibeacon
cordova-plugin-ibeacon copied to clipboard
IOS Plugin not working...
Hello,
First of all many thanks for your plugin, it works fantastic with Android ! However we are experiencing some problems with the IOS part...
Below the log error :
2015-07-26 21:55:32.658 Drill[2803:789649] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/BDD12FCC-191B-478C-9… 2015-07-26 21:55:32.981 Drill[2803:789649] Apache Cordova native platform version 3.8.0 is starting. 2015-07-26 21:55:32.983 Drill[2803:789649] Multi-tasking -> Device: YES, App: YES 2015-07-26 21:55:32.991 Drill[2803:789649] Unlimited access to network resources 2015-07-26 21:55:33.224 Drill[2803:789649] [CDVTimer][keyboard] 0.428021ms 2015-07-26 21:55:33.225 Drill[2803:789649] [CDVTimer][TotalPluginStartup] 1.187027ms 2015-07-26 21:55:33.729 Drill[2803:789649] Resetting plugins due to page load. 2015-07-26 21:55:34.743 Drill[2803:789649] Finished load of: file:///private/var/mobile/Containers/Bundle/Application/9C851889-0B46-4725… 2015-07-26 21:55:35.280 Drill[2803:789675] [DOM] registerDelegateCallbackId() 2015-07-26 21:55:35.304 Drill[2803:789676] Registering delegate callback ID: LocationManager1404003781 2015-07-26 21:55:35.304 Drill[2803:789649] peripheralManagerDidUpdateState() state: PeripheralManagerStatePoweredOn 2015-07-26 21:55:35.305 Drill[2803:789674] peripheralManagerDidUpdateState: PeripheralManagerStatePoweredOn 2015-07-26 21:55:35.305 Drill[2803:789649] didChangeAuthorizationStatus 2015-07-26 21:55:35.306 Drill[2803:789674] Converted peripheralManagerDidUpdateState: into peripheralManagerDidUpdateState 2015-07-26 21:55:35.306 Drill[2803:789649] didChangeAuthorizationStatus: 0 => AuthorizationStatusNotDetermined 2015-07-26 21:55:35.306 Drill[2803:789649] Converted locationManager:didChangeAuthorizationStatus: into didChangeAuthorizationStatus 2015-07-26 21:55:35.311 Drill[2803:789675] [DOM] _onDelegateCallback() null 2015-07-26 21:55:35.315 Drill[2803:789675] [DOM] _onDelegateCallback() {"eventType":"peripheralManagerDidUpdateState","state":"PeripheralManagerStatePoweredOn"} 2015-07-26 21:55:35.316 Drill[2803:789675] [DOM] _mapDelegateCallback() found eventType peripheralManagerDidUpdateState 2015-07-26 21:55:35.320 Drill[2803:789675] [DOM] _onDelegateCallback() {"eventType":"didChangeAuthorizationStatus","status":"AuthorizationStatusNotDetermined"} 2015-07-26 21:55:35.320 Drill[2803:789675] [DOM] _mapDelegateCallback() found eventType didChangeAuthorizationStatus
We already tried the solutions evoked in issue #123 (https://github.com/petermetz/cordova-plugin-ibeacon/issues/123) with no success...
We would really appreciate your help ! Feel free to ask me any complementary information necessary for finding the solution.
Best regards,
David-Henri
did you maybe forget to ask for permission? // required in iOS 8+ cordova.plugins.locationManager.requestWhenInUseAuthorization(); cordova.plugins.locationManager.requestAlwaysAuthorization();
Hi, thanks for your answer. As a matter of fact we did ask for permission. Anyone who had similar problem, could help ? I don't know if this is a known issue for IOS, so maybe we did something wrong ?
+1 We have the same issue. @dhbismuth - how did you resolve this?
Anyone been able to solve this?
We also have the same issue, on Android everything works like a charm setup 3 regions all get monitored but on iOS it will only monitor the first region.
@dhbismuth did you managed to fix this?
Is there a fix available anywhere? We've tried to contact @petermetz but without any result, is someone willing and able to fix this? We even could arrange a pay, we need it asap.
Hi
Maxime in copy managed to fix it for me. Maybe he can explain the solution. Le 20 janv. 2016 8:43 AM, "Dennis Bruijn" [email protected] a écrit :
Is there a fix available anywhere? We've tried to contact @petermetz https://github.com/petermetz but without any result, is someone willing and able to fix this? We even could arrange a pay, we need it asap.
— Reply to this email directly or view it on GitHub https://github.com/petermetz/cordova-plugin-ibeacon/issues/167#issuecomment-173119825 .
Hi,
Who's Maxime and how could we reach out to him?
2016-01-20 13:27 GMT+01:00 dhbismuth [email protected]:
Hi
Maxime in copy managed to fix it for me. Maybe he can explain the solution. Le 20 janv. 2016 8:43 AM, "Dennis Bruijn" [email protected] a écrit :
Is there a fix available anywhere? We've tried to contact @petermetz https://github.com/petermetz but without any result, is someone willing and able to fix this? We even could arrange a pay, we need it asap.
— Reply to this email directly or view it on GitHub < https://github.com/petermetz/cordova-plugin-ibeacon/issues/167#issuecomment-173119825
.
— Reply to this email directly or view it on GitHub https://github.com/petermetz/cordova-plugin-ibeacon/issues/167#issuecomment-173189897 .
Met positieve groet,
Dennis Bruijn Full-stack Web Developer
http://nl.linkedin.com/in/dbbruijn
http://goog_1423228033
I was wrong about monitoring 1 beacon on iOS, monitoring doesn't work at all. I've the feeling the whole plugin doesn't work for iOS.
+1
I face a similar issue with the monitoring function on iOS. I managed to get the event "didStartMonitoring" fired with the correct BeaconRegion, but that's it. The beacon is literally on the iDevice screen and it is not detected. I do not manage to get the events "didEnterRegion", "didExitRegion" or "didRangeBeaconsInRegion" fired. UUID is good, and other apps can successfully detect it.
@nikkow I managed to fix it! I'm trying to setup a repo with a basic Ionic project that detects beacons but in the meantime I'll could give you this, this is the code I've used
/*
* If the device is ready
*/
document.addEventListener("deviceready", function () {
/*
* Set default beacon info
*/
$rootScope.beacon = {
identifier: 'Default Ionic Beacon',
uuid: '927df354-116b-49e6-a264-989aa92200ee',
major: 1,
minor: 2,
};
/*
* Setup the beacon region
*/
var beaconRegion = new cordova.plugins.locationManager.BeaconRegion($rootScope.beacon.identifier, $rootScope.beacon.uuid, $rootScope.beacon.major, $rootScope.beacon.minor);
$rootScope.monitoredRegions = {};
/*
* Request iBeacon permissions
* For iOS 8 or higher
*/
cordova.plugins.locationManager.requestAlwaysAuthorization();
/*
* Delegate the events
*/
var delegate = new cordova.plugins.locationManager.Delegate();
/*
* On region enter
*/
delegate.didEnterRegion = function (pluginResult){
$rootScope.monitoredRegions[pluginResult.region.uuid] = pluginResult.region;
$rootScope.$apply();
}
/*
* On region exit
*/
delegate.didExitRegion = function (pluginResult){
$rootScope.monitoredRegions = {};
$rootScope.$apply();
}
cordova.plugins.locationManager.setDelegate(delegate);
cordova.plugins.locationManager.startMonitoringForRegion(beaconRegion);
});
Be sure to tick the checkboxes Location updates, Remote notifications and Uses bluetooth LE accessories in the Xcode project capabilities screen.
Here's the ionic project: https://github.com/0x1ad2/IonicBeacons
Hi guys, I'm still not able to get the readings from beacons on iOS, on android it works fine got Location updates, Remote notifications and Uses bluetooth LE accessories turned on here is the code:
$rootScope.$on('enableBeaconDetect', function (event, data) {
console.log('enableBeaconDetect Controller');
cordova.plugins.locationManager.requestWhenInUseAuthorization();
delegate = new cordova.plugins.locationManager.Delegate();
delegate.didDetermineStateForRegion = function (pluginResult) {
console.log('[DOM] didDetermineStateForRegion: ' + JSON.stringify(pluginResult));
cordova.plugins.locationManager.appendToDeviceLog('[DOM] didDetermineStateForRegion: '
+ JSON.stringify(pluginResult));
};
delegate.didStartMonitoringForRegion = function (pluginResult) {
console.log('didStartMonitoringForRegion:' + JSON.stringify(pluginResult));
};
delegate.didRangeBeaconsInRegion = function (pluginResult) {
console.log('[DOM] didRangeBeaconsInRegion: ' + JSON.stringify(pluginResult));
if (pluginResult.beacons.length > 0) {
if (pluginResult.beacons[0].rssi > -45) {
cordova.plugins.locationManager.stopRangingBeaconsInRegion(beaconRegion);
console.log("BEACON FOUND");
$rootScope.$broadcast('beaconValidationOk');
}
}
};
/*
* On region enter
*/
delegate.didEnterRegion = function (pluginResult){
console.log('[DOM] didEnterRegion: ' + JSON.stringify(pluginResult));
}
/*
* On region exit
*/
delegate.didExitRegion = function (pluginResult){
console.log('[DOM] didExitRegion: ' + JSON.stringify(pluginResult));
}
var uuid = data.uuid;
var identifier = 'iBeacon';
var minor = data.minor;
var major = data.major
beaconRegion = new cordova.plugins.locationManager.BeaconRegion(identifier, uuid, major, minor);
cordova.plugins.locationManager.setDelegate(delegate);
// required in iOS 8+
//cordova.plugins.locationManager.requestWhenInUseAuthorization();
// or cordova.plugins.locationManager.requestAlwaysAuthorization()
cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
.fail(function (e) {
console.error(e);
})
.done();
cordova.plugins.locationManager.startMonitoringForRegion(beaconRegion)
.fail(function (e) {
console.error(e);
})
.done();
});
Hi did you manage to resolve this ?
@asafper yes I did, use my code above.
Be sure to tick the checkboxes Location updates, Remote notifications and Uses bluetooth LE accessories in the Xcode project capabilities screen.
At first I didn't find those Capabilities options in XCode. It could be useful to someone this detailed info on where they are:
- Capabilities
- Background Modes
- Location updates
- Remote notifications
- Uses bluetooth LE accessories
- Background Modes