Nearby Messages API namespace reserved

399 Views Asked by At

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.

2

There are 2 best solutions below

0
On BEST ANSWER

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.

0
On

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.