I used com.android.camera.NEW_PICTURE
to check whether an image is captured or not.
(receiver android:name=\"NewPhotoReceiver\")
(intent-fil
As the broadcast intent action itself implies "com.android.camera.NEW_PICTURE
" is not generated within the android API framework, thus it shall not be listed in the android API documentation and of course it is not existing in any android API source .java
file.
But it is generated by an app (com.android.camera
) and only the app manufacturer and designers can list (in their app documentation or in the source code if open) which broadcast intent their app is sending.
It's not official - there can be a lot of different implementations to the camera app (by phone manufacturers and even market apps), so you should only use documented intent actions.
'com.android.camera.NEW_PICTURE' is NOT documented and not official. I don't know what is.
one problem that also occurs while using both actions with receivers
android:name="com.android.camera.NEW_PICTURE" android:name="android.hardware.action.NEW_PICTURE"
is duplicate call of onReceived() method on some devices (tested on Samsung Galaxy S4 Mini specifically) so you should prefer using only documented android:name="android.hardware.action.NEW_PICTURE"
From the source of the Camera app:
sendBroadcast(new Intent("com.android.camera.NEW_PICTURE", mLastContentUri));
So the data property of the intent contains the image URI. You can get the physical path by the methods discussed in this question.
If you want to take a picture from your application, refer to this question.
In API 14 (ICS) and above, you can use the action "android.hardware.action.NEW_PICTURE", which is referenced here:
http://developer.android.com/reference/android/hardware/Camera.html#ACTION_NEW_PICTURE
So I guess specifying both of them together should cover both past & future usage:
<intent-filter>
<action android:name="com.android.camera.NEW_PICTURE" />
<action android:name="android.hardware.action.NEW_PICTURE" />
<data android:mimeType="image/*" />
</intent-filter>
And the only question left is whether any OEM doen't broadcast "com.android.camera.NEW_PICTURE" on a pre-ICS Android...