sha1beaconeddystonegoogle-nearbygoogle-beacon-platform

Hello Beacons app not detecting virtual beacon (created with Beacon Simulator app)


I have followed the ten steps outlined in the Hello Beacon app tutorial at https://codelabs.developers.google.com/codelabs/hello-beacons/. There are no errors being thrown up during build. The only issue is that the virtual beacon (using Beacon Simulator app) is not detected by the Hello Beacon app. I know the problem is not with the beacon simulator because it gets detected by the beacon tools app by Google.

I don’t think there is any issue with the code because I have followed the tutorial exactly without deviation. However there are a few areas in the code and in the google developers console where parameters have to be defined. I suspect this could be causing the issue:

  1. I am not sure if I have defined "some_namespace", "some_type" correctly.

    SubscribeOptions options = new SubscribeOptions.Builder() .setStrategy(Strategy.BLE_ONLY) .setFilter(new MessageFilter.Builder() .includeNamespacedType("some_namespace", "some_type").build()) .build();

Here are a few parameters I tried –

I also tried implementing the code with and without -

 .setFilter(new MessageFilter.Builder()
 .includeNamespacedType("some_namespace", "some_type")
 .build()
  1. I am not sure where to run the command to generate the SHA1 fingerprint because I don’t completely understand its purpose. I have tried generating it from the .android folder, hello beacons folder and the JRE bin folder

Google Developers Console - SHA1 fingerprint / API Key

  1. I have placed the API key created at Google Developers Console in the Android Manifest file at:

    <meta-data android:name="com.google.android.nearby.messages.API_KEY" android:value="API_key_placed_here" />

I am not sure if that is the only place the API key needs to be placed.

I would appreciate any help from the community to resolve this issue.


Solution

  • I finally got it to work. The only issue was the access restriction that was set on the API key using the package name and SHA1 fingerprint. Once that was removed, the Hello Beacons app could detect my simulated beacon.

    In the optional step 10, I'm not sure what causes the error. Does it have something to do with the package name provided (com.google.android.gms.nearby.messages.samples.hellobeacons), or the SHA1 key? Difficult to say.

    Hope this helps.