internal void InitializeNative() { var ctx = Application.Context; if (!ctx.PackageManager.HasSystemFeature(PackageManager.FeatureBluetoothLe)) { return; } var statusChangeReceiver = new BluetoothStatusBroadcastReceiver(state => State = state); ctx.RegisterReceiver(statusChangeReceiver, new IntentFilter(BluetoothAdapter.ActionStateChanged)); _bluetoothManager = (BluetoothManager)ctx.GetSystemService(Context.BluetoothService); if (ShouldQueueOnMainThread) { TaskBuilder.MainThreadInvoker = action => { if (IsMainThread) { action(); } else { if (_handler == null) { _handler = new Handler(Looper.MainLooper); } _handler.Post(action); } }; } }
protected override void InitializeNative() { var ctx = Application.Context; if (!ctx.PackageManager.HasSystemFeature(PackageManager.FeatureBluetoothLe)) { return; } var statusChangeReceiver = new BluetoothStatusBroadcastReceiver(UpdateState); ctx.RegisterReceiver(statusChangeReceiver, new IntentFilter(BluetoothAdapter.ActionStateChanged)); _bluetoothManager = (BluetoothManager)ctx.GetSystemService(Context.BluetoothService); }