在 Locate 应用程序中检测到 iBeacon,但在 Beacon Tools 中未检测到
iBeacon detected in Locate app but not in Beacon Tools
我正在尝试从设备传输主要次要 ID,使其成为使用库的 iBeacon
compile 'org.altbeacon:android-beacon-library:2.9.2@aar'
代码
if (mBeaconTransmitter != null) {
mBeaconTransmitter.stopAdvertising();
}
BeaconParser beaconParser=new BeaconParser();
mBeaconTransmitter = new BeaconTransmitter(getApplicationContext(), new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
int flag= mBeaconTransmitter.checkTransmissionSupported(this);
Log.v("@@@WWe"," BEacon Test "+flag);
Beacon beacon = new Beacon.Builder()
.setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
.setId2(majorID)//Major
.setId3(minorID)//Minor
.setBluetoothName("Vyas Pratik")
.setBeaconTypeCode(533)
.setManufacturer(0x0075) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setTxPower(-59)
.setMultiFrameBeacon(true)
.build();
// .setId2(minorID)//Major Try
// .setId3(majorID)//Minor Try
//.setBluetoothAddress(bluetoothManager.getAdapter().getAddress())
// .setDataFields(Arrays.asList(new Long[]{0l}))
mBeaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {
@Override
public void onStartSuccess(AdvertiseSettings settingsInEffect) {
super.onStartSuccess(settingsInEffect);
Log.v("@@@WWe"," Sucess "+settingsInEffect.toString());
}
@Override
public void onStartFailure(int errorCode) {
super.onStartFailure(errorCode);
Log.v("@@@WWe"," Error "+String.valueOf(errorCode));
}
});
但是,我使用此代码的信标在定位应用程序中检测到,但在信标工具应用程序/附近(Google 应用程序)中未检测到。请指导我。
谢谢
经过多次试错,我找到了解决这个问题的方法,UUID和制造商ID是错误的。
所以我将其更改为低于值,现在在附近的 google 和信标工具
中检测到信标
Beacon beacon = new Beacon.Builder()
// .setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
// .setManufacturer(0x0118) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setId1("6d234454-cf6d-4a0f-adf2-f4911ba9ffa6")
.setManufacturer(0x4c) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setId2(majorID)//Major
.setId3(minorID)//Minor
.setBluetoothName("Vyas Pratik")
.setTxPower(-59)
.build();
我正在尝试从设备传输主要次要 ID,使其成为使用库的 iBeacon
compile 'org.altbeacon:android-beacon-library:2.9.2@aar'
代码
if (mBeaconTransmitter != null) {
mBeaconTransmitter.stopAdvertising();
}
BeaconParser beaconParser=new BeaconParser();
mBeaconTransmitter = new BeaconTransmitter(getApplicationContext(), new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
int flag= mBeaconTransmitter.checkTransmissionSupported(this);
Log.v("@@@WWe"," BEacon Test "+flag);
Beacon beacon = new Beacon.Builder()
.setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
.setId2(majorID)//Major
.setId3(minorID)//Minor
.setBluetoothName("Vyas Pratik")
.setBeaconTypeCode(533)
.setManufacturer(0x0075) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setTxPower(-59)
.setMultiFrameBeacon(true)
.build();
// .setId2(minorID)//Major Try
// .setId3(majorID)//Minor Try
//.setBluetoothAddress(bluetoothManager.getAdapter().getAddress())
// .setDataFields(Arrays.asList(new Long[]{0l}))
mBeaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {
@Override
public void onStartSuccess(AdvertiseSettings settingsInEffect) {
super.onStartSuccess(settingsInEffect);
Log.v("@@@WWe"," Sucess "+settingsInEffect.toString());
}
@Override
public void onStartFailure(int errorCode) {
super.onStartFailure(errorCode);
Log.v("@@@WWe"," Error "+String.valueOf(errorCode));
}
});
但是,我使用此代码的信标在定位应用程序中检测到,但在信标工具应用程序/附近(Google 应用程序)中未检测到。请指导我。
谢谢
经过多次试错,我找到了解决这个问题的方法,UUID和制造商ID是错误的。 所以我将其更改为低于值,现在在附近的 google 和信标工具
中检测到信标 Beacon beacon = new Beacon.Builder()
// .setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
// .setManufacturer(0x0118) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setId1("6d234454-cf6d-4a0f-adf2-f4911ba9ffa6")
.setManufacturer(0x4c) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setId2(majorID)//Major
.setId3(minorID)//Minor
.setBluetoothName("Vyas Pratik")
.setTxPower(-59)
.build();