[英]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. 您可以使用
PackageManager
和resolveActivity()
来查看设备是否为当前用户的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.