1

Currently when you activate nearby message api from your app, you will receive notification on the status bar, and there's a button "stop" and "setting", and if you explicitly click "stop" nearby messages will stop, my question is how to receive that stop action under my app perhaps using broadcast receiver, but i don't know what action should i put on intent filter ?

Second, i noticed that even though i disconnected googleApiClient on my "onStop" nearby is still active, is that really how it works ?

4

1 回答 1

0
  1. 如果您单击通知上的停止,则将调用 PublishOptions.PublishCallback.onExpired() 进行发布,并调用 Subscribecallback.onExpired() 进行订阅。

    您可以在此处找到文档。

  2. 当您与 GoogleApiClient 断开连接时,活动的发布和订阅将自动停止并清理。为了代码清晰和冗余,Google 建议您在 Activity 的 onStop() 方法中明确取消发布或取消订阅。见https://developers.google.com/nearby/messages/android/pub-sub

于 2016-05-19T15:57:56.623 回答