Proximity beacons radars are mixing with each

#1

Hello everyone,
I’m having a problem with Proximity beacons. In every onEnter() method of the Proximity zones I have added a code that will move the user to another activity using Intent.
What’s happening with me is that the code of zone1 is the only code that can do this action and move to the other Activity but the other zones (beacons) are not even entering the onEnter() method. They are just staying in .onContextChange() method.

//Connect the application.
EstimoteCloudCredentials cloudCredentials = new EstimoteCloudCredentials(“Don’t worry I have entered in a right way”, “Don’t worry I have entered in a right way”);

    //Create the Proximity Observer
    this.proximityObserver = new ProximityObserverBuilder(getApplicationContext(), cloudCredentials)
                    .onError(new Function1<Throwable, Unit>() {
                        @Override
                        public Unit invoke(Throwable throwable) {
                            Log.e("app", "proximity observer error: " + throwable);
                            return null;
                        }
                    })
                    .withBalancedPowerMode()
                    .build();

final ProximityZone zone = new ProximityZoneBuilder()
.forTag(“room”)
.inCustomRange(3.0)
.onEnter(new Function1<ProximityZoneContext, Unit>() {
@Override
public Unit invoke(ProximityZoneContext context) {
Intent intent = new Intent(MainActivity.this,FirstRoom.class);
startActivity(intent);
Toast.makeText(MainActivity.this, “First Room”, Toast.LENGTH_SHORT).show();
return null;
}
})
.onExit(new Function1<ProximityZoneContext, Unit>() {
@Override
public Unit invoke(ProximityZoneContext context) {
Log.d(“app”, “Bye bye, First Room”);
return null;
}
})
.onContextChange(new Function1<Set<? extends ProximityZoneContext>, Unit>() {
@Override
public Unit invoke(Set<? extends ProximityZoneContext> proximityZoneContexts) {
Toast.makeText(MainActivity.this, “Still in first room”, Toast.LENGTH_SHORT).show();
return null;
}
})
.build();

final ProximityZone zone2 = new ProximityZoneBuilder()
.forTag(“room”)
.inCustomRange(3.0)
.onEnter(new Function1<ProximityZoneContext, Unit>() {
@Override
public Unit invoke(ProximityZoneContext context) {
String pathOwner = context.getAttachments().get(“second-room”);
Intent intent2 = new Intent(MainActivity.this,SecondZone.class);
startActivity(intent2);
Toast.makeText(MainActivity.this, “Welcome th second office”, Toast.LENGTH_SHORT).show();
Log.d(“app”, "Welcome to Second Office ");
return null;
}
})
.onExit(new Function1<ProximityZoneContext, Unit>() {
@Override
public Unit invoke(ProximityZoneContext context) {
Log.d(“app”, “Bye bye, Second Office!”);
return null;
}
})
.onContextChange(new Function1<Set<? extends ProximityZoneContext>, Unit>() {
@Override
public Unit invoke(Set<? extends ProximityZoneContext> proximityZoneContexts) {
Toast.makeText(MainActivity.this, “Still in second office”, Toast.LENGTH_SHORT).show();
return null;
}
})
.build();

RequirementsWizardFactory
.createEstimoteRequirementsWizard()
.fulfillRequirements(this,
// onRequirementsFulfilled
new Function0() {
@Override public Unit invoke() {
Log.d(“app”, “requirements fulfilled”);
proximityObserver.startObserving(zone,zone2);
Toast.makeText(MainActivity.this, “fulfilled”, Toast.LENGTH_SHORT).show();
return null;
}
},
// onRequirementsMissing
new Function1<List<? extends Requirement>, Unit>() {
@Override public Unit invoke(List<? extends Requirement> requirements) {
Log.e(“app”, "requirements missing: " + requirements);
Toast.makeText(MainActivity.this, “Requirement Error”, Toast.LENGTH_SHORT).show();
return null;
}
},
// onError
new Function1<Throwable, Unit>() {
@Override public Unit invoke(Throwable throwable) {
Log.e(“app”, "requirements error: " + throwable);
Toast.makeText(MainActivity.this, “Error”, Toast.LENGTH_SHORT).show();
return null;
}
});
}

So how can I solve this problem.

1 Like
#2

hi !
ProximityZone zone1 and ProximityZone zone2 are basically the same. you’re looking for the same tag/range. I think there is no way to solve your problem because of this: Proximity SDK More Details on Beacon and also this: What's the best approach for reacting on beacons when entering a zone of approximatly 3m or less?
I was thinking that probably one hack could be add a particular tag for each particular beacon then add a zone for triggerin onEnter/onExit events for any particular tag. I think this is probably overkill and I’m really lazy for trying. :slight_smile:
probably some Estimote people could teach us some (lazier) solution.
cheers !
dx

#3

see: How many beacons can i monitore?