Problem with (beacon.getRssi(), beacon.getMeasuredPower()

i used some method to calculate the distance as shown in the image
but when i run the app it crashes
what is the problem ?

Hi @yazeed72,

maybe it’s more easy to use the Estimote SDK methods: RegionUtils.computeAccuracy().

I used it also down below and i face same problem when i run the app it crashes

Have you placed some logs to see where it crashes?

it crashes here here :

I don’t really know, have you declarated your Activity in the AndroidManifest.xml file?

It looks like the crash is on line 28 in your code, and it’s a Null Pointer Exception, which means you’re most likely calling getRssi/getMeasuredPower on a null object. Which makes sense, because you’re calling it in your Activity’s onCreate, which means you most likely don’t have any beacons detected yet at this point.

1 Like

Yes, I have

the problem is in the code(line 28) only

If I remove it, the code WORKS FINE