Reputation: 6912
I want to listen take picture action.
I use below code:
<receiver
android:name="CameraButtonActivity">
<intent-filter>
<action
android:name="android.intent.action.CAMERA_BUTTON"
/>
<category
android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</receiver>
public class CameraButtonActivity extends BroadcastReceiver {
static final String ACTION = "android.intent.action.CAMERA_BUTTON";
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ACTION)) {
System.out.println("Take picture");
}
}
}
But it seems not works.
How can I arrive the request?
Upvotes: 0
Views: 1795
Reputation: 1052
You should listen to the action
public static final String ACTION_NEW_PICTURE
This is a Broadcast Action which is fired when a new picture is taken by the camera, and the entry of the picture has been added to the media store. getData() is URI of the picture.
Constant Value: "android.hardware.action.NEW_PICTURE"
Also check this link of the same question.
Hope this helps
Upvotes: 1