Commit 9a1cf7d4 authored by Muhammad Handharbeni's avatar Muhammad Handharbeni

solve notification

parent 0c48203d
...@@ -164,6 +164,8 @@ public class MainService extends Service implements BeaconConsumer { ...@@ -164,6 +164,8 @@ public class MainService extends Service implements BeaconConsumer {
beaconManagers.removeAllMonitorNotifiers(); beaconManagers.removeAllMonitorNotifiers();
beaconManagers.removeAllRangeNotifiers(); beaconManagers.removeAllRangeNotifiers();
beaconManagers.addRangeNotifier((collection, region) -> { beaconManagers.addRangeNotifier((collection, region) -> {
updateNotification(String.format("%d Beacon In Range", Constant.getListSNBeacon().size()));
isStartRange = true; isStartRange = true;
Constant.setListNativeBeacon(new ArrayList<>()); Constant.setListNativeBeacon(new ArrayList<>());
Constant.setListSNBeacon(new ArrayList<>()); Constant.setListSNBeacon(new ArrayList<>());
...@@ -172,7 +174,6 @@ public class MainService extends Service implements BeaconConsumer { ...@@ -172,7 +174,6 @@ public class MainService extends Service implements BeaconConsumer {
if (countAlt < maxCountAlt){ if (countAlt < maxCountAlt){
countAlt++; countAlt++;
} }
updateNotification(String.format("%d Beacon In Range", 0));
}else{ }else{
Constant.setListNativeBeacon(new ArrayList<>()); Constant.setListNativeBeacon(new ArrayList<>());
Constant.setListSNBeacon(new ArrayList<>()); Constant.setListSNBeacon(new ArrayList<>());
...@@ -203,7 +204,6 @@ public class MainService extends Service implements BeaconConsumer { ...@@ -203,7 +204,6 @@ public class MainService extends Service implements BeaconConsumer {
listBeacon.add(estimoteBeacon); listBeacon.add(estimoteBeacon);
} }
} }
updateNotification(String.format("%d Beacon In Range", Constant.getListSNBeacon().size()));
if (counterUserCoordinate >= maxCounterUserCoordinate) { if (counterUserCoordinate >= maxCounterUserCoordinate) {
if (listBeacon.size() > 0){ if (listBeacon.size() > 0){
...@@ -220,7 +220,6 @@ public class MainService extends Service implements BeaconConsumer { ...@@ -220,7 +220,6 @@ public class MainService extends Service implements BeaconConsumer {
if (!beaconManagers.isBound(MainService.this)){ if (!beaconManagers.isBound(MainService.this)){
beaconManagers.bind(MainService.this); beaconManagers.bind(MainService.this);
} }
updateNotification(String.format("%d Beacon In Range", 0));
beaconManagers.startRangingBeaconsInRegion(regions); beaconManagers.startRangingBeaconsInRegion(regions);
} }
} catch (RemoteException e) { } catch (RemoteException e) {
...@@ -230,7 +229,6 @@ public class MainService extends Service implements BeaconConsumer { ...@@ -230,7 +229,6 @@ public class MainService extends Service implements BeaconConsumer {
@Override @Override
public void didExitRegion(Region region) { public void didExitRegion(Region region) {
updateNotification(String.format("%d Beacon In Range", 0));
} }
@Override @Override
...@@ -240,12 +238,10 @@ public class MainService extends Service implements BeaconConsumer { ...@@ -240,12 +238,10 @@ public class MainService extends Service implements BeaconConsumer {
switch (i){ switch (i){
case MonitorNotifier.INSIDE : case MonitorNotifier.INSIDE :
if (!isStartRange){ if (!isStartRange){
updateNotification(String.format("%d Beacon In Range", 0));
beaconManagers.startRangingBeaconsInRegion(regions); beaconManagers.startRangingBeaconsInRegion(regions);
} }
break; break;
case MonitorNotifier.OUTSIDE : case MonitorNotifier.OUTSIDE :
updateNotification(String.format("%d Beacon In Range", 0));
break; break;
} }
}catch (Exception e){ }catch (Exception e){
......
{ {
"name": "react-native-benibeacon", "name": "react-native-benibeacon",
"version": "1.1.8", "version": "1.1.9",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment