Skip to content Skip to sidebar Skip to footer

Android Broadcastreceiver Not Stopping Camera Intent Action

I am trying to 'block' the Camera action while my application is active. The onReceive method is being executed on the BroadcastReceiver, but by the LogCat it seems to be doing so

Solution 1:

Actually I was able to do it by adding

<categoryandroid:name="android.intent.category.DEFAULT" />

to my intent fiter, so it looks like:

<receiverandroid:name="com.receiver.CameraReceiver"><intent-filter><actionandroid:name="android.intent.action.CAMERA_BUTTON" /><categoryandroid:name="android.intent.category.DEFAULT" /></intent-filter></receiver>

and this seems to be working, can anybody comment to if this or the android:priority is the proper way.

Also, if I can stop the 'Vibrate' that happens on button press that would be helpful.

Thanks!

Solution 2:

I don't know exactly whether i'm completely wrong about this, but it's my understanding, that a BroadcastReceiver won't stop another activity but is being executed parallely.

Edit: I found a thread in the google android dev group that might help you: click

The essence: Set high priority of your Receiver to a high value, so Android chooses your app to start first when the camera button is pressed.

<intent-filter android:priority=*"10000"*>

And first line of your onReceive(): abortBroadcast();

Post a Comment for "Android Broadcastreceiver Not Stopping Camera Intent Action"