0

I am trying to implement beacon scanning with Firebase, Nearby Messages and iBeacons. I have followed Googles docs on how to set up the beacons and started a service which handles Messages. But the only response I get is:

Message received: Message{namespace='__reserved_namespace', type='__i_beacon_id', content=[20 bytes]}

My namespace type is project-name-1234/room with data test. I subscribe to Nearby Messages like this:

 MessageFilter messageFilter = new MessageFilter.Builder()
            .includeIBeaconIds(UUID, major, minor)
            .includeNamespacedType("project-name-1234/room", "test")
            .build();

 SubscribeOptions options = new SubscribeOptions.Builder()
            .setStrategy(Strategy.BLE_ONLY)
            .setFilter(messageFilter)
            .build();

 Nearby.Messages.subscribe(mGoogleApiClient, getPendingIntent(), options);

It seems to be a problem with my namespace but I can't figure out what it it is.

Wilder Pereira
  • 2,249
  • 3
  • 21
  • 31
hboy
  • 301
  • 3
  • 17

2 Answers2

2

Use IBeaconId.from(Message) to parse your message. Also see https://developers.google.com/nearby/messages/android/get-beacon-messages for end to end example on how to work with beacons.

Tony Tran
  • 234
  • 1
  • 5
0

Are you sure your namespace is correct? Especially the "/room" part? I would say it should be "project-name-1234".

Anyway I would try to include all messages from your project and see what namespace you get:

MessageFilter messageFilter = new MessageFilter.Builder()
    .includeIBeaconIds(UUID, major, minor)
    .includeAllMyTypes()
    .build();

Also pay attention that the beacons have to be registered in the same Google project as you are connecting in your app. Match of namespace and type is not enough.

Dietatko
  • 374
  • 1
  • 13