Notification notification = new Notification.Builder(this)
.setSmallIcon(android.R.drawable.ic_dialog_info)
.setContentTitle("Beacon Scanner")
.setContentText("Scan is running...")
.build();
EstimoteCloudCredentials cloudCredentials = new EstimoteCloudCredentials("XXXX", "XXXXX");
ProximityObserver proximityObserver = new ProximityObserverBuilder(getApplicationContext(), cloudCredentials)
.withBalancedPowerMode ()
.withScannerInForegroundService(notification)
.withOnErrorAction(new Function1<Throwable, Unit>() {
@Override
public Unit invoke(Throwable throwable) {
return null;
}
})
.build();
// Java
ProximityZone venueZone =
proximityObserver.zoneBuilder()
.forAttachmentKeyAndValue("venue", "office")
.inFarRange()
.withOnEnterAction(new Function1<ProximityAttachment, Unit>() {
@Override public Unit invoke(ProximityAttachment proximityAttachment) {
Log.d("testmax","withOnEnterAction");
return null;
}
})
.withOnExitAction(new Function1<ProximityAttachment, Unit>() {
@Override
public Unit invoke(ProximityAttachment proximityAttachment) {
Log.d("testmax","withOnExitAction");
return null;
}
})
.withOnChangeAction(new Function1<List<? extends ProximityAttachment>, Unit>() {
@Override
public Unit invoke(List<? extends ProximityAttachment> proximityAttachments) {
Log.d("testmax","pippo");
return null;
}
})
.create();
observationHandler =
proximityObserver
.addProximityZone(venueZone)
.start();
In EstimoteCloudCredentials I have insert my credential. I read the beacon unique ID in log Android Studio, so suppose that it is all correct but I not receve never callback in enter in exit or change action.
I have used Android 6.0.1 on Samsung SM-T805 and on Raspberry Pi with Android Things.
Check if you have location permissions enabled. Also try to replace .withBalancedPowerMode() with .withLowLatencyPowerMode(). I suppose that this phone might not support low power consumption modes and when told to start scanning it throws an error. We are working to have a fix in SDK that will do this automatically.
Android Things on Raspberry Pi3 has its own issues with Bluetooth. I tried to run the same code on PICO-IMX7 and Raspberry Pi3 and on first one it worked and on second one it failed. It seems that is platform problem.
If you have a problem with SDK please open an issue on GitHub: https://github.com/Estimote/Android-Proximity-SDK/issues
I have already tried change in .withLowLatencyPowerMode () but nothing has changed, permission is active, I have already developed other apps with estimative sdk and everything is ok. We want to get support for Android 8.1, so integrating the proximity. For android things for now it does not work on raspberry?
I have tried on ONE PLUS Andorid 7.1.1 but i have the same issue.
Could you get some logs from logcat? We need to find out if issue is in scanning or in Cloud communication. Without logs it will be quite hard. Can you also check if Estimote App can scan those beacons? And check if other apps are also scanning properly (for example nRFConnect).
Have you configured attachments in Estimote Cloud? Have you checked you don’t have any typos there?
For Android Things is does not work on Raspberry out of a box, but it does for PICO-IMX7.
Paweł here, from ProximitySDK team. We are currently adding enhancements to support more phone models (with some Samsung devices among them), and those changes will be introduced in the next alpha release. Also, we did test our SDK with Android Things platform recently. BLE scanning works well on NXP i.MX7D, but Raspberry Pi 3 has some bugs in kernel, that makes it difficult to scan beacons - we suggest using NXP for now. We are going to notify Google about the RPI problems, and I hope it will be fixed in the next DP of Android Things.
As for your problem - we checked your beacons in our database and it seems that they have Estimote Monitoring disabled. Well, basically, your beacons are not advertising the packet needed by our algorithm to work properly. You need to connect to your beacons (using our app from Play Store/App store) and enable Estimote Monitoring there. This should allow your app to work properly
I can not enable the option, as a response I get “you can not change while the mesh is locked”. I used https://cloud.estimote.com/v3/mesh/2036/override_lock to unlock and is really unlocked but when I try to enable the option it blocks the beacon and I get the same message “you can not change while the mesh is locked” .
Ok, it seems that there is a known-issue with caching mechanism on our Cloud - we are working on that. Your account should now be able to see your mesh as “unlocked”. The easiest way to turn on Estimote Monitoring is through our app - just connect to one of your beacons and enable it. The mesh should propagate this setting for you to other devices. You can also turn it on manually with connecting to each of your devices separately (I encourage you to use our NFC - just touch one of our beacons with a phone with Estimote App installed and NFC turned on)
Hi, now everything is working correctly even if I noticed a long delay in trigger the exit. For Android Things on raspberry it is now working, what problems did you find?
We’re still improving the algorithm. You can play with inCustomRange() to find out the best setup for your case.
As for RaspberryPI - the issue is related to the large amounts of beacons around (as in our office), so it might not occur to you.