public class BeaconManager
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static interface |
BeaconManager.ErrorListener
错误监听
|
static interface |
BeaconManager.MonitoringListener
Monitoring监听
|
static interface |
BeaconManager.RangingListener
Ranging监听
|
static interface |
BeaconManager.ServiceReadyCallback
服务开启回调
|
构造器和说明 |
---|
BeaconManager(Context context) |
限定符和类型 | 方法和说明 |
---|---|
boolean |
checkPermissionsAndService()
检查权限及服务是否配置进清单文件中
|
void |
connect(BeaconManager.ServiceReadyCallback callback)
连接BeaconService
|
void |
disconnect()
断开连接
|
boolean |
hasBluetooth()
检测是否支持蓝牙4.0BLE
|
boolean |
isBluetoothEnabled()
检测蓝牙是否可用
|
void |
setBackgroundScanPeriod(long scanPeriodMillis,
long waitTimeMillis)
设置Monitoring扫描周期
|
void |
setErrorListener(BeaconManager.ErrorListener listener)
设置错误监听
|
void |
setForegroundScanPeriod(long scanPeriodMillis,
long waitTimeMillis)
设置ranging扫描周期
|
void |
setMonitoringExpirationMill(long time)
设置monitoring的到期时间
|
void |
setMonitoringListener(BeaconManager.MonitoringListener listener)
设置Monitoring监听
|
void |
setRangingExpirationMill(long time)
设置ranging的到期时间
|
void |
setRangingListener(BeaconManager.RangingListener listener)
设置Ranging监听
|
void |
startMonitoring(Region region)
开启监控
|
void |
startRanging(Region region)
开始扫描刷新
|
void |
stopMonitoring(Region region)
停止监控
|
void |
stopRanging(Region region)
停止刷新扫描
|
public boolean hasBluetooth()
public boolean isBluetoothEnabled()
public boolean checkPermissionsAndService()
public void connect(BeaconManager.ServiceReadyCallback callback)
callback
- 服务是否准备好的回调public void disconnect()
public void setRangingListener(BeaconManager.RangingListener listener)
listener
- Ranging监听public void setMonitoringListener(BeaconManager.MonitoringListener listener)
listener
- Monitoring监听public void setErrorListener(BeaconManager.ErrorListener listener)
listener
- public void setForegroundScanPeriod(long scanPeriodMillis, long waitTimeMillis)
scanPeriodMillis
- 扫描周期waitTimeMillis
- 等待时间public void setBackgroundScanPeriod(long scanPeriodMillis, long waitTimeMillis)
scanPeriodMillis
- 扫描间隔waitTimeMillis
- 等待时间public void startRanging(Region region) throws RemoteException
region
- 扫描的regionRemoteException
public void stopRanging(Region region) throws RemoteException
region
- 扫描的regionRemoteException
public void startMonitoring(Region region) throws RemoteException
region
- 监控的regionRemoteException
public void stopMonitoring(Region region) throws RemoteException
region
- 监控的regionRemoteException
public void setMonitoringExpirationMill(long time)
time
- 设置的时间 单位为spublic void setRangingExpirationMill(long time)
time
- 设置的时间 单位为s