하나의 iPhone은 locate 응용 프로그램을 사용하여 ibeacon을 전송하는 데 사용됩니다 (근접 uuid는 2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 임). 안드로이드 폰은 ibeacon을 감지하는 데 사용됩니다.altbeacon api를 사용하여 탐지 된 비콘이 없음
08-30 15 : 33 : 나는 디버깅 할 때 , 나는 다음과 같은 메시지가 얻을 수 있습니다 57.051 D/BluetoothLeScanner을 (27939) : onScanResult() - ScanResult {mDevice = 6D : CC : 9D : 8D : 3A : F3, mScanRecord = ScanRecord [mAdvertiseFlags = 26, mServiceUuids = null, mManufacturerSpecificData = {76 = [2,21,47,35,68,84, -49, 109, 74, 15, -83, -14, -12 0, 0, -59]}, mServiceData = {}, mTxPowerLevel = -2147483648, mDeviceName = null], mRssi = -31, mTimestampNanos = -111, 27, -87, -1, -90, 58705755631306}
그러나 기능이 RangingBeaconsInRegion
인 경우에는 비컨이 없습니다. 당신이 beaconParsers을 설정하는 코드를 자세히 보면
public class MainActivity : XFormsApplicationDroid, IBeaconConsumer
{
public MainActivity()
{
}
protected override void OnCreate(Bundle bundle)
{
BeaconManager beaconManager = BeaconManager.GetInstanceForApplication(this);
var iBeaconParser = new BeaconParser();
iBeaconParser.SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
var parser = new BeaconParser();
parser.SetBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
beaconManager.BeaconParsers.Add(parser);
beaconManager.Bind(this);
}
public void OnBeaconServiceConnect()
{
//obtain the beaconservie object of android
var beaconService = Xamarin.Forms.DependencyService.Get<IbeaconService>();
beaconService.InitializeService();
//beaconService.StartTransmitting();
beaconService.StartMonitoring();
beaconService.StartRanging();
}
public void InitializeService()
{
m_beaconManager = InitializeBeaconManager();
}
private BeaconManager InitializeBeaconManager()
{
BeaconManager bm = BeaconManager.GetInstanceForApplication(Xamarin.Forms.Forms.Context);
//set the scan window
bm.SetForegroundScanPeriod(1100L);
//subscribe to the events;
m_monitorNotifier.EnterRegionComplete += EnteredRegion;
m_monitorNotifier.ExitRegionComplete += ExitedRegion;
m_monitorNotifier.DetermineStateForRegionComplete += DeterminedStateForRegionComplete;
m_rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
// constructs a new region object to be used for ranging or monitoring
m_tagRegion = new Region("myUniqueBeaconId", Identifier.Parse("E4C8A4FC-F68B-470D-959F-29382AF72CE7"), null, null);
m_tagRegion = new Region("myUniqueBeaconId", Identifier.Parse("B9407F30-F5F8-466E-AFF9-25556B57FE6D"), null, null);
m_tagRegion = new Region("myUniqueBeaconId", Identifier.Parse("2F234454-CF6d-4A0F-ADF2-F4911BA9FFA6"), null, null);
m_emptyRegion = new Region("myEmptyBeaconId", null, null, null);
bm.SetBackgroundMode(false);
//
//bm.Bind((IBeaconConsumer)Xamarin.Forms.Forms.Context);
return bm;
}
public void StartRanging()
{
BeaconManagerInstance.SetForegroundBetweenScanPeriod(0L);
m_beaconManager.AddRangeNotifier(m_rangeNotifier);
m_beaconManager.StartRangingBeaconsInRegion(m_tagRegion);
m_beaconManager.StartRangingBeaconsInRegion(m_emptyRegion);
}
고마워, 그건 내 실수 야! 다른 비컨 파서를 추가하기 위해 두 번째 호출을 추가 한 후! 여전히 이상한 상황이 있습니다 : 나는 어떤 비콘 송신기도 실행하지 않았지만, 디버깅 할 때 다음과 같은 메시지가 나타납니다 : – Zhou
그것은 블루투스 LE 광고가 탐지되는 것처럼 보이지만, 바이트는 어떤 알려진 비컨처럼 보이지 않습니다. 체재. 내 추측으로는 신호에서 오는 것이 아니라 Bluetooth LE가있는 다른 종류의 장치입니다. – davidgyoung