Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

ngCordova ibeacon: $rootScope.$on don't fire?

$
0
0

@luckyluke2012 wrote:

Hey guys,
I am trying to build my first app with ionic and angular. In this app I want to use an ibeacon. My problem is now, that I can't get any information from the ibeacon.
I tried this here as discribed: ibeacon ngCordova,
also this: support ibeacons in your ionic framework ,but I'm still not able to get it to run.
I even reinstalled the ibeacon plugin from github and checked the permissons for bluetooth in the android xml file.

Here is my Code:

angular.module('meineapp.datactrl', ['btford.socket-io','angular-md5','ionic','ngCordova'])

.controller('DataCtrl', function($rootScope,$scope,socket,md5,$ionicPlatform,$ionicPopup,$ionicLoading,$cordovaGeolocation,$cordovaBeacon){

	$scope.beacon = {};
	$ionicPlatform.ready(function () {
		//Beacon
		var identifier = "Beacon";
		var uuid = "f0018b9b-7509-4c31-a905-1a27d39c003c";
		var major = 23075;
		var minor = 20481;
		var notifyEntryStateOnDisplay = true;
			$scope.startRangingBeaconsInRegion = function() {
				$cordovaBeacon.startRangingBeaconsInRegion($cordovaBeacon.createBeaconRegion(
					identifier, uuid, major, minor, notifyEntryStateOnDisplay)
				);
			};
			$rootScope.$on("$cordovaBeacon:didRangeBeaconsInRegion", function (ev, pluginResult) {

					$scope.beacon.proximity = pluginResult.beacons[0].proximity;
					$scope.$apply();
			});
	});});

I hope somebody can tell me, what I'm doing wrong.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>