# How can I detect 4 ibeacon using ionic in sme area

**URL:** <https://forum.ionicframework.com/t/how-can-i-detect-4-ibeacon-using-ionic-in-sme-area/89331>\
**Category:** Ionic Native\
**Created:** [May 8, 2017, 7:42am UTC](https://forum.ionicframework.com/t/how-can-i-detect-4-ibeacon-using-ionic-in-sme-area/89331 "2017-05-08T07:42:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![terryshek](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@terryshek](https://forum.ionicframework.com/u/terryshek)\
**Post date:** [May 8, 2017, 7:42am UTC](https://forum.ionicframework.com/t/how-can-i-detect-4-ibeacon-using-ionic-in-sme-area/89331/1 "2017-05-08T07:42:35Z")

</div>

Hi, recently I am working a project using ionic 2 to detect each ibeacon in those 4 zone in the exhibition. Find that the native function ionic 2 can detect ibeacon, but how can i register 4 BeaconRegion in one application ? many thx !

---

<div class="post-metadata">

**Author:** ![saty932](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/saty932/32/114572_2.png) [@saty932](https://forum.ionicframework.com/u/saty932)\
**Post date:** [September 17, 2017, 4:08am UTC](https://forum.ionicframework.com/t/how-can-i-detect-4-ibeacon-using-ionic-in-sme-area/89331/2 "2017-09-17T04:08:55Z")

</div>

We have used below code to get data from api calls and applying those beacons details to ibeacons. Try this one.

```
	this.appService.getBeacons()
			.subscribe(beacons => {
				console.log(beacons);
				var i=0;
				for(i=0;i<beacons.length;i++){
					// setup a beacon region – CHANGE THIS TO YOUR OWN UUID
					this.region = this.IBeacon.BeaconRegion(beacons[i].beaconDetailes.beaconId,beacons[i].beaconDetailes.uuid);
					this.region.NotifyEntryStateOnDisplay = true;
					this.region.NotifyOnEntry = true;
					this.region.NotifyOnExit = true;

					// start ranging
					this.IBeacon.startMonitoringForRegion(this.region)
					.then(
						() => {
							resolve(true);
							console.log("monitor for region");
						},
						error => {

							resolve(false);
						}
						);

					this.IBeacon.startRangingBeaconsInRegion(this.region)
					.then(
						() => {
							resolve(true);
						},
						error => {

							resolve(false);
						}
						);
				}
			}
			);
```
