where is android.camera.NEW_PICTURE defined?

前端 未结 5 1742
-上瘾入骨i
-上瘾入骨i 2020-12-10 19:57

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

(receiver android:name=\"NewPhotoReceiver\")
    (intent-fil         


        
相关标签:
5条回答
  • 2020-12-10 20:09

    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.

    0 讨论(0)
  • 2020-12-10 20:10

    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.

    0 讨论(0)
  • 2020-12-10 20:15

    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"

    0 讨论(0)
  • 2020-12-10 20:16

    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.

    0 讨论(0)
  • 2020-12-10 20:23

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

    0 讨论(0)
提交回复
热议问题