In your Android manifest, you should indicate what intentions you want to receive. For the camera, which will be the following code (this applies to the <application> tags):
<receiver android:name="com.receiver.CameraReceiver"> <intent-filter android:priority="10000"> <action android:name="android.intent.action.CAMERA_BUTTON" /> </intent-filter> </receiver>
In addition to this, you should add this to your <intent-filter> in the <activity> tags:
<category android:name="android.intent.category.DEFAULT" />
Finally, take care of the event in your activity code as follows:
@Override public void onReceive(Context context, Intent intent) { abortBroadcast();
source share