我需要找到附近的所有信标。我尝试使用以下代码:https://altbeacon.github.io/android-beacon-library/samples.html 但我收藏零。我使用nRF Connect(来自市场),她向我展示了所有信标。 我不明白如何设置Beacon Layout,它是什么?请帮帮我
public class FragmentMain extends Fragment实现BeaconConsumer {
import pyorient
####establishing connection with OrientDB
client=pyorient.OrientDB('localhost',2424)
session_id=client.connect('root','kavin')
####connect to database
####create one when there is no database
if client.db_exists('sample_db',pyorient.STORAGE_TYPE_MEMORY):
client.db_open('sample_db','root','kavin')
print('db exists')
else:
print('db doesn\'t exists')
client.db_create('sample_db',pyorient.DB_TYPE_GRAPH,pyorient.\
STORAGE_TYPE_MEMORY
Traceback (most recent call last):
File "<pyshell#67>", line 1, in <module>
.......
timeout: timed out
}
答案 0 :(得分:0)
只需修改此行:
beaconManager = BeaconManager.getInstanceForApplication(getActivity());
之后添加以下行:
beaconManager = BeaconManager.getInstanceForApplication(getActivity());
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("x,s:0-1=feaa,m:2-2=20,d:3-3,d:4-5,d:6-7,d:8-11,d:12-15"));
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19"));
我只向您展示了如何添加两个布局(EDDYSTONE-TLM和EDDYSTONE-UID的布局)。您可能也想添加其他内容。您可以在此处查看可以添加的列表:
答案 1 :(得分:0)
您肯定需要使用布局管理器。您使用的是Eddystone,iBeacon还是什么样的信标?我在这里写了一个例子,看看它:https://solidgeargroup.com/beacons-on-android