4

I used com.android.camera.NEW_PICTURE to check whether an image is captured or not.

(receiver android:name="NewPhotoReceiver")
    (intent-filter)

            (action android:name="com.android.camera.NEW_PICTURE"/)

            (data android:mimeType="image/*"/)

    (/intent-filter)
(/receiver)

But com.android.camera.NEW_PICTURE is not discussed any where in android developers site.

Akshay
  • 2,506
  • 4
  • 34
  • 55
surath
  • 61
  • 1
  • 5

5 Answers5

9

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...

dab
  • 361
  • 3
  • 4
  • I was wondering why this wasn't working for my. After installing a new camera app to the emulator I saw that I forgot to put the and tags around this excellent answer. – m02ph3u5 Oct 17 '14 at 15:41
1

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.

Community
  • 1
  • 1
molnarm
  • 9,856
  • 2
  • 42
  • 60
0

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.

AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
0

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"

DoubleK
  • 542
  • 3
  • 16
0

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.

maxshuty
  • 9,708
  • 13
  • 64
  • 77
Zanna
  • 676
  • 9
  • 13