Hi,
I want to use Bluetooth and therefore register a receiver in my activity:
localBT = BluetoothAdapter.getDefaultAdapter();
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
this.registerReceiver(mReceiver, filter);
Unfortunately the application crashes in the third line. Here is the code of mReceiver:
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("log", "onReceive");
}
};
I assume, the error is quite simple, but I don't find it. Is there anything in the manifest, I have to include, besides the activity itself and the permissions BLUETOOTH and BLUETOOTH_ADMIN?
<activity android:name=".BTDevice" android:label="@string/app_name">
</activity>
<uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"></uses-permission>