How to get UUID, Major, and Minor Values from ranging Android

If I am using ranging beacon searching, how do I get the beacons’ UUIDs, Majors, and Minor values? I am using the Android APK. I want to scan for beacons, and if I find a certain beacon with certain uuid, major and minor, then I will have some kind of operation, if not then I will keep searching. Also if I find another beacon that I am not interested in, I would like to do a different operation.

You have to use the class BeaconManager that has the method setRangingListener on which you override the onBeaconsDiscovered. It return a list of Beacons. Now you have to use the class Beacon. It has some methods that help you, like getProximityUUID(), getMajor() and getMinor().

I hope to have been helpfull.

Are you building your own app with Android SDK? If so, check out the Proximity Content template from Estimote Cloud—it does something very similar (changes background color based on which beacon is nearby).

Hi All would like to know without providing UUID to app, How can I detect beacons around me. I tried using beacon manager setRangingListener(), didnt get anything. Can you please provide me a code snippet for the same? Thank you

You can follow our ranging tutorial:

http://developer.estimote.com/android/tutorial/part-3-ranging-beacons/

… and simple modify the Region, passing null instead of an UUID:

region = new Region("ranged region", null, null, null);

This should allow you to detect all iBeacon packets.

Hello I also wanted to know in Android, If app is closed, I want to invoke app as soon as I am in range of beacon. What is happening with me is if I write a service. Monitoring gives me only 1 time scan result. and If i use ranging it gives me results continuously. I want to detect that I have entered in beacon range, I want to get nearest among all beacons in that range and do a custom action based on that. Like sending notification

You do not need to write your own service for Estimote Android SDK to work in the background. We run our own service inside the SDK to do that.

What you can do is, run monitoring, and when onEntered happens, start ranging to determine which beacon might be the closest. When you’re done, stop ranging to conserve the smartphone’s battery. WDYT?

Hello @heypiotr

I want to detect nearest beacons and get UUID, major and minor but i am not using estimote beacons and i am using Bluetooth Scanner

Here is a link for a gist of my code https://gist.github.com/AhmedBadrSayed/fb53b4aa06edd6505e40b028bbc328d2

You can follow our ranging tutorial:

http://developer.estimote.com/android/tutorial/part-3-ranging-beacons/48

… and simple modify the Region, passing null instead of an UUID:

region = new Region(“ranged region”, null, null, null);
This should allow you to detect all iBeacon packets.

Hi heypiotr, about this answer, this not worked for me.
I’m following the part 2 of tutorial and when i run the app, nothing happens.
The code never enter in ‘onEnteredRegin’, neither after change de listener to listen any beacon, like you mentioned above.

I run the tests on a Lenovo Vibe K5, Android 5.1.1
Version of SDK: 0.16.0