为什么Estimote beacon没有在Android上检测到?

时间:2016-09-19 08:43:49

标签: android beacon estimote

我正在使用estimote sdk制作Estimote信标,我已经添加了APP_ID和APP_TOKEN,但它仍然无法检测到。

@Override
public void onCreate() {
  super.onCreate();

  beaconManager = new com.estimote.sdk.BeaconManager(getApplicationContext());

  EstimoteSDK.initialize(getApplicationContext(), Constants.APP_ID, Constants.APP_TOKEN);

   beaconManager.setMonitoringListener(new com.estimote.sdk.BeaconManager.MonitoringListener() {
     @Override
     public void onEnteredRegion(com.estimote.sdk.Region region, java.util.List<com.estimote.sdk.Beacon> list) {
          showNotification("Welcome to the shop", "You are in");
     }

     @Override
     public void onExitedRegion(com.estimote.sdk.Region region) {

     }
  });
}

权限

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

请仔细阅读我的帖子并向我推荐一些解决方案。

解决方案

beaconManager.setNearableListener(new BeaconManager.NearableListener() {
        @Override
        public void onNearablesDiscovered(java.util.List<com.estimote.sdk.Nearable> nearables) {

        }
    });

    beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            scanId = beaconManager.startNearableDiscovery();
        }
    });

1 个答案:

答案 0 :(得分:0)

尝试使用需要监控的UUID和次要专业:

    // this is were we left off:
    beaconManager = new BeaconManager(getApplicationContext());
   // add this below:
   beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
   @Override
    public void onServiceReady() {
      beaconManager.startMonitoring(new BeaconRegion(
            "monitored region",
            UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"),
            22504, 48827));
    }
   });