Camera intent filter

淺唱寂寞╮ 提交于 2020-02-05 08:14:26

问题


I need some help on camera intent / filter. Below are my questions.

  • What is the intent filter I should use to make my app handle camera intent ?
  • Are there any apps which handles a camera intent(ACTION_IMAGE_CAPTURE) ?

What I am trying to figure out is, if I through an intent with filter ACTION_IMAGE_CAPTURE, is it possible for any 3rd party app to respond for my request?

Any help is appreciated.


回答1:


1. What is the intent filter I should use to make my app handle camera intent ?

Ans) should be included in the manifest file intent-filter of the activity which can handle a camera

2. Are there any apps which handles a camera intent(ACTION_IMAGE_CAPTURE) ?

Ans)Pudding Camera, LINE Camera, Uva silent camera Free,..

I got confused because intent used to call camera app is android.provider.MediaStore.ACTION_IMAGE_CAPTURE and intent-filter used in manifest file is android.media.action.IMAGE_CAPTURE.

Thanks for all who replied.

Thanks,

Sai.




回答2:


2:

Yes, any app can respond to the ACTION_IMAGE_CAPTURE intent. Don't know if you have more than 1 on your device but you can easily try out. (fire the intent)




回答3:


If you have two ore more apps installed that can handle the intent, the system will prompt you automatically which to use. If you need some code to handle the results let me know.




回答4:


You should add this to the manifest:

        <intent-filter>
            <action android:name="android.media.action.IMAGE_CAPTURE"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        <intent-filter>
            <action android:name="android.media.action.STILL_IMAGE_CAMERA"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        <intent-filter>
            <action android:name="android.media.action.VIDEO_CAMERA"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>

As for apps, there are plenty of apps that handle the intents. Just search for "Camera" on the Play Store. Here's the one of Google:

https://play.google.com/store/apps/details?id=com.google.android.GoogleCamera&hl=en



来源:https://stackoverflow.com/questions/12373075/camera-intent-filter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!