use registerReceiver for non activity and non service class
问题 I am trying to registerReceiver for BluetoothDevice events like ACTION_ACL_CONNECTED , ACTION_ACL_DISCONNECTED . But the class in which I am using registerReceiver does not extend Activity class nor Service class - so I am passing Context to that class and registering receiver as follows context.registerReceiver(ActionFoundReceiver, new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED)); context.registerReceiver(ActionFoundReceiver, new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED));