Thursday, February 16, 2012

[android-developers] about Permission Denial: not allowed to send broadcast android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED

I creat an IntentFilter which manually calls BT broadcast receiver as
follows:

IntentFilter disConnectFilter = new
IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED);
registerReceiver(_disConnectReceiver, disConnectFilter);

private BroadcastReceiver _disConnectReceiver = new
BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
BluetoothDevice bdevice =
intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if(BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)){
Log.d("acl disconnect", "acl disconnect");
}}}};


But in Runtime I got the following Exception:
ERROR/AndroidRuntime(4054): Caused by: java.lang.SecurityException:
Permission Denial: not allowed to send broadcast
android.bluetooth.device.action.ACTION_ACL_DISCONNECTED

I gave both BT permission in my manifest file, but still it doesn't
work .

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment