Beacon Detection (Eddystone) with Android API

I am trying to detect beacons around me, but with the API, I can not find them.

I use this method to detect nearby devices:

public void startDiscovery(String serviceId, final OnDiscoveryListener l) { Nearby.Connections.startDiscovery(googleApiClient, serviceId, Connections.DURATION_INDEFINITE, new Connections.EndpointDiscoveryListener() { @Override public void onEndpointFound(String endpointId, String deviceId, String serviceId, String endpointName) { if (l != null) { l.onEndpointFound(endpointId, deviceId, serviceId, endpointName); } } @Override public void onEndpointLost(String s) { if (l != null) { l.onEndpointLost(s); } } }) .setResultCallback(new ResultCallback<Status>() { @Override public void onResult(Status status) { if (l != null) { l.onResult(status); } } }); } 

The listener is as follows:

 public interface OnDiscoveryListener { public void onResult(Status status); public void onEndpointFound(String endpointId, String deviceId, String serviceId, String endpointName); public void onEndpointLost(String s); } 

But I can't find anything

+5
source share
4 answers

Although Google touts using the Nearground API to detect beacons around us:

A compatible API for Android and iOS makes it easy for apps to find and communicate with neighboring devices and beacons.

Source: http://android-developers.blogspot.be/2015/07/lighting-way-with-ble-beacons.html

I was unable to use the Nearground API to detect Eddystone beacons. I will describe all the information that I collected during my research, hoping that this can save some time.

I had the same code set up for you to identify Estimote beacons, but I could not find the service identifier to provide Nearby.Connections.startDiscovery() so that it would detect my beacon (I tried to use the beacon UUID and some options without success).

I found on the Estimote website that you need to update the beacon firmware to configure it as an Eddystone beacon: http://developer.estimote.com/eddystone/#configure-estimote-beacons-to-broadcast-eddystone . Mine was wrong, I did it.

However, this did not solve my problem, and I still could not detect the beacon using the API. I tried setting it as Eddystone-UID and the URL of Eddystone and tried several combinations (based on the information provided by the Estimote application) as the service identifier failed.

A deeper look at the documentation for a similar API shows that Google does not mention anything about lighthouses or Eddystone in its API documentation ( https://developers.google.com/nearby/connections/overview ) and the Google sample lighthouses do not use Nearby API: https://github.com/google/beacon-platform/tree/master/samples/android

However, they mention that “Nearby Messages” will allow for rich interaction, such as “co-editing, grouping, voting, or broadcasting a resource ” and will soon be:

Coming soon: Companion messaging API will be available on Google Play 7.8. This site will be updated with full API documentation when a new version is available.

Source: https://developers.google.com/nearby/

As I understand it, beacon support will be available in Google Play Services 7.8, as beacons transmit resources.

In the meantime, if you still want to detect the Eddystone beacons around you, you can use the Estimote Android SDK: https://github.com/estimote/android-sdk#quick-start-for-eddystone or implement the same code as Google Beacon Proximity Sample: https://github.com/google/beacon-platform/tree/master/samples/android

+2
source

I am working on the Google API on Google. The code snippet above uses the Connections Connections API, which is actually targeted at various use cases. To work with Eddystone, use the supported message API. Here's an example of using the "Near" to sign up for the presence of beacons

Note that you must first associate the Message payload with the beacon using the Beacon approximation API .

+4
source

This may seem strange - but try turning Wi-Fi on and off. Many cheaper devices do not work well with Bluetooth and do not connect, but for some reason disables Wi-Fi and fixes it for a while.

I had a similar problem: everything in my code was correct, but did not detect beacons. I even tried with the applications of the manufacturers, and they also could not find the beacon (but their version for the iPhone was made). I turned off Wi-Fi, then turned on again, and the manufacturer application worked, as well as mine.

0
source

Yes, you can detect Eddystone beacons using the API. But to detect beacons, you should use the Nearby Messages API not the Nearby Connections API , as @Andrew Bunner mentions.

To be able to recognize beacons using NearbyMessagesAPI , you will also need to register beacons with the first Google, and then configure them to communicate with them.

You can find all the steps in your blog post or in this other answer I posted.

0
source

All Articles