I have developed Android app to detect the beacon if the customer is near to 1 mt distance . I am using Android Beacon Library to develop the application.When we are in for
The problem is that when your app goes to the background, the MainActivity will call onPause, and the code inside that method calls the mBeaconManager.unbind(this); method, which effectively stops beacon ranging.
If you want ranging to continue in the background, the easiest thing to do is move the following two lines:
mBeaconManager.startRangingBeaconsInRegion(new Region("treewalker", null, null, null));
mBeaconManager.addRangeNotifier(this);
to the BeaconApp class' didDetermineStateForRegion method. You'll also need to move the didRangeBeaconsInRegion and showNotification methods there, too.