cordova-plugin-ibeacon icon indicating copy to clipboard operation
cordova-plugin-ibeacon copied to clipboard

iOS8 As Beacon not working

Open cfh463 opened this issue 9 years ago • 2 comments

I am running your sample code to start a device as a Beacon (iOS8).

I am getting

Advertising is accepted, but won't start until peripheral manager is powered on.

But Bluetooth is powered on. Also the promise does not error in this scenario

cordova.plugins.locationManager.isAdvertisingAvailable()
    .then(function(isSupported){

        if (isSupported) {
            cordova.plugins.locationManager.startAdvertising(beaconRegion)
                .then(function(){
                  console.log('Beacon Started');
                })
                .fail(function(e){
                  console.log('Could not start');
                  console.log(JSON.stringify(e));
                  })
                .done();
        } else {
            console.log("Advertising not supported");
        }
    })
    .fail(console.error)
    .done();

Logs:

(lldb) 2015-03-17 13:03:38.699 beacontest[1166:437710] [Default measuredPower will be used.
2015-03-17 13:03:38.700 beacontest[1166:437710] Advertising is accepted, but won't start until     peripheral manager is powered on.
(lldb) 2015-03-17 13:03:38.715 beacontest[1166:436366] Beacon Started

cfh463 avatar Mar 17 '15 17:03 cfh463

Making progress but still not out of woods. I added to the pList:

<key>UIBackgroundModes</key>
<array>
  <string>bluetooth-peripheral</string>
</array>

And was prompted when the app started to allow sending BT data. It also shows up in the Settings/App page as Bluetooth Sharing (On toggle)

But I still get Advertising is accepted, but won't start until peripheral manager is powered on

cfh463 avatar Mar 17 '15 17:03 cfh463

OK looks like my two devices are an Iphone4 and an iPad 2 - even though these both have been upgraded to OS'es that support BTLE, the actual hard ware does not.

You need: actual device which supports BLE (iPhone 4S and up, iPad mini and iPad 3 and up)

I would still like to keep this open as it should return a fail when called.

The clue that led me to find the answer was a few lines up in the log:

{"eventType":"peripheralManagerDidUpdateState","state":"PeripheralManagerStateUnsupported

cfh463 avatar Mar 17 '15 18:03 cfh463