我正在尝试从OnScanResult发送消息或广播意图用于ble设备,但我不断收到异常
public override void OnScanResult(ScanCallbackType callbackType, ScanResult result)
{
base.OnScanResult(callbackType, result);
Intent i = new Intent(BluetoothDevice.ActionFound);
i.PutExtra(BluetoothDevice.ExtraDevice, i);
var device = result.Device;
if (device != null)
{
Android.App.Application.Context.SendBroadcast(i);
// MessagingCenter.Send<IScanSender, Android.Bluetooth.BluetoothDevice>(this, "btScanner", device);
}
}
我得到
Java.Lang.SecurityException: Permission Denial: not allowed to send broadcast android.bluetooth.device.action.FOUND
广泛意向
或
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation
。
用于尝试发送消息