Greetings, I can’t find any documentation how to obtain the color of a beacon? I realize you have to be connected to Estimote Cloud.
Also, what is http://estimote.github.io/Android-SDK/JavaDocs/com/estimote/sdk/Beacon.html#getName()
and how can you set the value? I’m seeing “EST” and “estimote” has the response to all of my beacons currently.
Thanks in advance!
I think I figured it out:
EstimoteCloud.getInstance().fetchBeaconDetails(beacon.getMacAddress(), new CloudCallback<BeaconInfo>() {
@Override
public void success(BeaconInfo beaconInfo) {
Log.e(TAG, beaconInfo.color);
}
@Override
public void failure(EstimoteServerException e) {
Log.e(TAG, "BEACON INFO ERROR: " + e);
}
});
1 Like
Hi, how can I do this on the new Proximity SDK? thanks
We have no native classes/wrappers for querying the Cloud at this point in the new SDK. You can instead query the Estimote Cloud API yourself:
https://cloud.estimote.com/docs/#api-Devices-GetDevice
At Estimote, we like the OkHttp library for querying our APIs, here’s an example on how to query an API for JSON data:
You’d want to use url(https://cloud.estimote.com/v2/devices/IDENTIFIER_HERE)
, and this to extract the color:
String jsonData = responses.body().string();
JSONObject Jobject = new JSONObject(jsonData);
String color = Jobject.getString("color");