0

I am using google's NearBy Messages API to publish some messages from server(An android device here) and subscribe for those messages from client(Another android device) .

In this I want to maintain log timings of client at server side

  • when client found the published message
  • when client goes out of range
  • when client cancel subscription

But till now I didn't find anything in API to notify above things. Let me know if there are any solutions.

And one more thing publishing with Strategy.BLE_ONLY gives status in in ResultCallback#onResult like

Status{statusCode=TTL_SECONDS_INFINITE is not currently supported for publishes., resolution=null}
shobhan
  • 1,460
  • 2
  • 14
  • 28

2 Answers2

1

Have you seen this developer guide? https://developers.google.com/nearby/messages/android/pub-sub

  • When the client found the message, this is called public void onFound(Message message)
  • When client goes out of range, this is called public void onLost(Message message)
  • Publisher cannot know when subscriber cancel subscription, the subscriber itself should know when it stops subscribe. ie. when it calls unsubscribe. Additionally, subscriber can specify SubscribeCallback to figure out when its subscription expired or user stopped the subscription. See the developer guide above.

For publish, you cannot use Strategy.BLE_ONLY now. You can use Strategy.DEFAULT to do publish or follow the simple example from the guide above to do the publish.

Tony Tran
  • 234
  • 1
  • 5
  • client knows when message found and lost but what I need is server should know that when new client receives message. – shobhan Jun 22 '16 at 07:01
1

If I am reading your question correctly, you have a setup where one Android device publishes and a second Android device subscribes. Based on that, here are some answers:

when client found the published message

The publisher has no way to know when the subscriber found the message (unless the subscriber also publishes, and the publisher also subscribes).

when client goes out of range

The publisher will not know when a subscriber is no longer in range. Two things to note: 1) The subscriber will know when a publisher goes out of range because that information will get surfaced in onLost(), and 2) What you want becomes possible to implement if both devices publish and subscribe.

when client cancel subscription

Again, the publisher has no way of knowing when a subscriber has stopped subscribing in the setup you have AFAIK.

Shailen Tuli
  • 13,815
  • 5
  • 40
  • 51