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:
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 –
“beacon-proximity-app”, “impdata”
“a72d91966ecd43888771”
(from the Beacon Simulator app), “beacon-proximity-app/imdata”
(from Beacon Tools app)
“beacon-proximity-app/impdata”, “”
“beacon-proximity-app”, “string”
“a72d91966ecd43888771”
(from the Beacon Simulator app), “beacon-proximity-app/string”
(from Beacon Tools app)
I also tried implementing the code with and without -
.setFilter(new MessageFilter.Builder()
.includeNamespacedType("some_namespace", "some_type")
.build()
Google Developers Console - SHA1 fingerprint / API Key
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.
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.