Android Temperature

Hello,

As I have been reading previous posts, I still could’nt find a detailed explication about how to extract temperature in a java code for it to be displayed in our application. Could anyone provide us with the appropriate tutorial?

Thank you in advance.

Hello @Peter_Breidy!

Thanks for reporting that. Just to be perfectly sure, have you checked this tutorial ?
http://developer.estimote.com/sensors/estimote-telemetry/

There you can find an example how to obtain temperature data, using Estimote Android SDK. Take use of EstimoteTelemetry object that is passed with onTelemetriesFound() method. That object stores sensors data, including temperature values.

You can also check EstimoteTelemetry java doc for getting further information:
http://estimote.github.io/Android-SDK/JavaDocs/com/estimote/sdk/telemetry/EstimoteTelemetry.html

Hello @arek

Yes I’ve checked both documentations, however, I am still getting the following error: java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results.

Kindly find bellow the piece of code that I’m trying to upload on my android mobile:

public class MainActivity extends AppCompatActivity {
private BeaconManager beaconManager;
private String scanId;
private String text= "Temperature: ";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EstimoteSDK.initialize(getApplicationContext(), “APP ID”, “APP TOKEN”);
beaconManager = new BeaconManager(this);
beaconManager.setTelemetryListener(new BeaconManager.TelemetryListener(){

        @Override
        public void onTelemetriesFound(List<EstimoteTelemetry> telemetries) {
            for(EstimoteTelemetry tlm : telemetries){
                ((TextView) findViewById(R.id.textView)).setText(text+""+tlm.temperature);
            }
        }
    });
}

@Override protected void onStart() {
    super.onStart();
    beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            scanId = beaconManager.startTelemetryDiscovery();
        }
    });
}

}

Moreover, I only have 3 types of packets in my Estimote Beacon:
1- Estimote Default
2- Eddystone-UID
3- Eddystone-URL

As I saw in previous posts, that we need to enable the the telemetry packets of the beacon…

My bad with respect to the error, I’m not used to this type of errors since I’m new to Android. I gave the application the permission to access the location, However, I still cannot visualize any temperature value in my application.
If you could please help me fixing the problem as soon as possible. @arek @heypiotr

Thank you

You mentioned only 3 packets available to be broadcasted. It seems that you use Proximity Beacons which cannot broadcast Estimote Telemetry packets. No worries, you are still able to receive temperature value from the beacon. :slight_smile:

Firstly, establish connection with the beacon. Once you did it, you are able to read that values striclty from the device. Here you have device tutorial including establishing connection or reading settings from the device:
https://github.com/Estimote/Android-SDK/blob/master/DOC_deviceConnection.md

Thank you for your prompt reply @arek.
I followed this quick tutorial, but I am not being able to see any object that invokes temperature.
How is this even true:
// Do something with your object.
// ScanResultItem contains basic info about device discovery - such as RSSI, TX power, or discovery time.
// It also contains ConfigurableDevice object. You can easily acquire it via item.configurableDevice’

““item.configurableDevice”” cannot be invoked !!

Should be instead:
“item.device” which returns a configurableDevice object.

Hello,

I also follow this document. I also can’t find beacons’ battery life, temperature etc…

Please provide us detail document for item.device so we can create connection with beacon and get there all data.

If we have UUID, Major, Minor then how can we create device and create connection like iOS?

I noticed that in iOS they can create connection by using UUID, Major, Minor.

Best Regards,
Monik.

I did it with Android but connecting with Estimote Cloud. If it helps I could upload this code to github.
I understand that get the temperatue without connecting to Estimote Cloud is possible but I don’t know how.

Regards,
Martin

Hello @tinoper,

Yes I would be grateful if you could post the code on github. And please can you share the link with us?
At least we will be able to read the temperature :smile:
Thank you !

Hi @Peter_Breidy, I hope this could help you. Take a look at https://github.com/tinoper/BeaconsLab and let me know if it helps.

I posted a really simple project to get temperature from our beacons.

Regards,

1 Like

Hello @tinoper,

Thank you for posting your code. However, I think you are using a different type of beacons. Mine is a proximity beacon which I tried doing the same thing but did not work. I hope someone on Estimote community can help us solve this issue.
Thank you again Martin.

Regards
Peter

Sorry, you are right Peter. I understand that Prox beacons don’t broadcast the temp.

Regards,
Martin