Can I use ibeacon with ionicFramework

Hey guys, I’m working on an SDK that lets devs use a big network of pre-installed beacons at various venues.

madewithray.com

Thought it might be helpful for those wanting to use the tech but not necessarily buy, install and maintain the hardware.

Sorry to dig up some skeletons here, but I have a tutorial on how to use iBeacons with Ionic Framework:

Uses the plugin by Peter Metz and a wrapper that I wrote.

Best,

1 Like

Hello,

Does anyone knows a plugin in order to “emit” instead of ranging and monitoring ?

What do you mean with emit?

I use the evothings plugin…

I meant, that I would like to detect with ibeacons other phones.

Oh I see, we can do it with the evothings plugin :smile:

:smile:
Did you mean simulating an ibeacon with your phone?

@BioPhoton YES !
On Android AND Ios

Hi Nicraboy, does it only work with estimote ibeacons? Or also from other manufacturers? (we are using “skybeacons” at the moment)

As long as they emit iBeacon format Yes!

allright cool thanks! We have some problems with “monitoring” on iOS9+. With android it works fine, anybody here have some iBeacon monitoring action working on iOS9+?

What is yout problem? Did you registered the UUID’s you want to monitor?

yeah, and it seems to work in Android, but we can’t get iOS9+ to work. Can you verify that you have it working on iOS9+?

It will work with any beacon that follows the iBeacon spec.

Thanks for your reply @nicraboy, and i think we’ve fixed the iOS9+ issue :slight_smile:

Hi, I still have problems get monitoring working in background. :frowning:

Here is My Code:

$ionicPlatform.ready(function() {

  var systemVersion = ionic.Platform.version(),
      versionArray = systemVersion.toString().split('.');
  window.locationManager = cordova.plugins.locationManager;

  var delegate = new locationManager.Delegate();

  delegate.didDetermineStateForRegion = function (pluginResult, test) {
    console.log('stateForRegion' + JSON.stringify(pluginResult) + JSON.stringify(test));
  };

  delegate.didStartMonitoringForRegion = function (pluginResult) {
    console.log("monitoring" + JSON.stringify(pluginResult.region.minor));
  };

  // Called continuously when ranging beacons.
  delegate.didRangeBeaconsInRegion = function (pluginResult) {
    for (var i in pluginResult.beacons) {
      var beacon = pluginResult.beacons[i];
      console.log("range:" + beacon.minor);
    }

  };

  // Set the delegate object to use.
  locationManager.setDelegate(delegate);

  if (parseInt(versionArray[0]) >= 8) {
    // Request permission from user to access location info.
    // This is needed on iOS 8+.
    cordova.plugins.locationManager.requestWhenInUseAuthorization();
    //locationManager.requestAlwaysAuthorization();
  }

  // Start monitoring and ranging beacons.
  var beaconRegion = new locationManager.BeaconRegion('1', "699EBC80-E1F3-11E3-9A0F-0CF3EE3BC012", '1', '11775', "Yes");

  // Start monitoring.
  locationManager.startMonitoringForRegion(beaconRegion)
    .fail(console.log('error while startMonitoringForRegion: ' + beaconRegion.uuid, JSON.stringify(beaconRegion)))
    .done();

  // Start ranging.
  locationManager.startRangingBeaconsInRegion(beaconRegion)
    .fail(console.log('error while startRangingBeaconsInRegion: ' + beaconRegion.uuid, JSON.stringify(beaconRegion)))
    .done();

}); 

Could anybody be so kind and help me out here??

Just to add to this, ngCordova now has beacon functionality: http://ngcordova.com/docs/plugins/beacon/

Solved! :slightly_smiling:

If you want to monitor iBeacons (for or background) request authorisation like this:
cordova.plugins.locationManager.requestAlwaysAuthorization();

@BioPhoton: Did you manage to show a notification when an iBeacon is detected (when app is in background)? Could you maybe put your piece of code here and mention which plugins you used? I can’t seem to wrap my head around this…

shure!
heres the repo for the poc. => https://github.com/BioPhoton/ios-cordova-ibeacon-monitoring-poc