是否可以在不使用Proximity API的情况下使用NearBy API? [英] Is possible to use NearBy API with out Proximity API?

查看:110
本文介绍了是否可以在不使用Proximity API的情况下使用NearBy API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用可以与iBeacon或Eddystone配合使用的信标,我创建了一个扫描仪,该扫描仪的后台服务每10秒扫描一次信标,类似于android-beacon-library,但我当时在想我可以使用NearBy API来获取带有扫描服务的信标,这有可能吗?我不想使用ProximityAPI来注册信标,因为这些信标将在那里存在而无需注册它们.

I'm using a beacon that can work either with iBeacon or Eddystone, I create a scanner that has a service in the background which scans each 10 secs for beacons, similar to the android-beacon-library, but I was thinking that I could use the NearBy API to get the beacons with out the scan service, Is that possible?, I don't want to use the ProximityAPI to register the beacons because these beacons will be out there with out the need to register them.

推荐答案

要使用附近的API,您的信标必须同时在Google云中注册,并且必须具有

In order to use the Nearby API, your beacons must both be registered with the Google cloud, and have attachments as described here.

Nearby API的工作方式,您创建一个MessageListener并在找到带有附加消息的信标时订阅以获取回调:

The way the Nearby API works, you create a MessageListener and subscribe to get callbacks when beacons are found with messages attached to them:

订阅时,除了您的应用程序在其他设备上发布的任何消息外,您的应用程序还将自动接收您已附加到BLE信标的所有消息.

When subscribing, your app will automatically receive any messages that you've attached to BLE beacons, in addition to any messages published by your app on other devices.

https://developers.google.com/nearby/messages/android/get-beacon-messages

如果没有附加任何消息,则不会收到任何回调

If there aren't any messages attached to them, you won't get any callbacks

这篇关于是否可以在不使用Proximity API的情况下使用NearBy API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆