Question

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?

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);
Was it helpful?

Solution

There is no guarantee that any Android device supports any particular Intent structure for any particular user. 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.

You can use PackageManager and resolveActivity() to see if the device supports a particular Intent for startActivityForResult() for the current user. Or, you can catch the ActivityNotFoundException that will be raised.

Beyond that, most devices for most users should support the ACTION_PICK Intent (or, better yet, ACTION_GET_CONTENT). Somewhat fewer devices will support ACTION_IMAGE_CAPTURE, simply because not all devices have a camera.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top