简体   繁体   English

Android MediaStore.ACTION_IMAGE_CAPTURE和Intent.ACTION_PICK

[英]Android MediaStore.ACTION_IMAGE_CAPTURE and Intent.ACTION_PICK

Im interested to know if the following android intents are available on every device or are they available only on some devices as com.android.camera.action.crop is? 我有兴趣知道以下android意图是否在每台设备上都可用,或者它们仅在某些设备上可用,例如com.android.camera.action.crop

Intent for picking an image from gallery: 从图库中选择图像的意图:

Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

Intent for taking a picture from built-in camera: 从内置相机拍摄照片的意图:

Intent(MediaStore.ACTION_IMAGE_CAPTURE);

There is no guarantee that any Android device supports any particular Intent structure for any particular user. 不能保证任何Android设备都支持任何特定用户的任何特定Intent结构。 For example, with restricted profiles on Android 4.3+ tablets, even devices that have a camera app may not support ACTION_IMAGE_CAPTURE for a particular profile, because it is not allowed by the device owner. 例如,在Android 4.3+平板电脑上使用受限制的配置文件,即使具有摄像头应用程序的设备也可能不支持针对特定配置文件的ACTION_IMAGE_CAPTURE ,因为设备所有者不允许这样做。

You can use PackageManager and resolveActivity() to see if the device supports a particular Intent for startActivityForResult() for the current user. 您可以使用PackageManagerresolveActivity()来查看设备是否为当前用户的startActivityForResult()支持特定的Intent Or, you can catch the ActivityNotFoundException that will be raised. 或者,您可以捕获将引发的ActivityNotFoundException

Beyond that, most devices for most users should support the ACTION_PICK Intent (or, better yet, ACTION_GET_CONTENT ). 除此之外, 大多数用户的大多数设备都应支持ACTION_PICK Intent (或者更好的是ACTION_GET_CONTENT )。 Somewhat fewer devices will support ACTION_IMAGE_CAPTURE , simply because not all devices have a camera. 支持ACTION_IMAGE_CAPTURE的设备要少一些,这是因为并非所有设备都配有摄像头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Android中使用MediaStore.ACTION_IMAGE_CAPTURE意图捕获图像 - capturing images with MediaStore.ACTION_IMAGE_CAPTURE intent in android MediaStore.ACTION_IMAGE_CAPTURE - MediaStore.ACTION_IMAGE_CAPTURE 具有action =“ MediaStore.ACTION_IMAGE_CAPTURE”的意图的类别是什么? - What is the class for the intent with action = “MediaStore.ACTION_IMAGE_CAPTURE”? 应用Intent MediaStore导致应用程序崩溃 - App crashing with Intent MediaStore.ACTION_IMAGE_CAPTURE 没有为意图MediaStore调用Google GlassOnActivityResult。ACTION_IMAGE_CAPTURE - Google Glass OnActivityResult not called for intent MediaStore.ACTION_IMAGE_CAPTURE 无法将文件路径添加到MediaStore.ACTION_IMAGE_CAPTURE意向 - Trouble with adding file path to the MediaStore.ACTION_IMAGE_CAPTURE intent 从Intent(MediaStore.ACTION_IMAGE_CAPTURE)获取图像uri - get image uri from Intent(MediaStore.ACTION_IMAGE_CAPTURE) Android 问:意图(MediaStore.ACTION_IMAGE_CAPTURE) - 未找到处理意图的活动 - Android Q: Intent(MediaStore.ACTION_IMAGE_CAPTURE) - No Activity found to handle Intent 找不到用于处理MediaStore.ACTION_IMAGE_CAPTURE目的的活动 - No Activity found to handle MediaStore.ACTION_IMAGE_CAPTURE Intent AndroidIntent。ACTION_PICK - Android Intent.ACTION_PICK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM