1

In android there is 2 well known methods for getting images using android's default intents.

Gallery intent

To pick image from gallery, we usually do this:

    Intent intent =new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(intent, 1);

Camera Intent

To open camera and capture image, we usually do this:

    Intent intent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
    startActivityForResult(intent, 2);

And finally we get the result in onActivityResult callback.

Question

I noticed that some chat apps (well-known ones) use a custom gallery picker, and a custom camera capture method.

They don't use android's default methods, which seems to be the easier way.

So my question is, does all android devices (mainly android 4 and above) support the above 2 methods or not?

I need to make sure that the above methods are supported by all devices.

Thanks.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
Hasan Bou Taam
  • 4,017
  • 2
  • 12
  • 22

3 Answers3

1

There are some problems with specific devices, especially samsung, xiaomi. But they are getting better. Generally it should be available on every device but reality kicks in.

Example.

Camera intent not working with Samsung Galaxy S3

Selecting image from gallery not working on Redmi Note 4

Camera intent for ACTION_IMAGE_CAPTURE does not appear on Samsung Galaxy Nexus(4.0.2)

Tuby
  • 3,158
  • 2
  • 17
  • 36
  • So why other apps build custom gallery, if it is available through intent? – Hasan Bou Taam Mar 02 '18 at 18:05
  • I think, because they want to fit client gallery into their design standards. They might think that default gallery doesn't look good. – Tuby Mar 02 '18 at 18:08
  • Maybe that is the case, but I also found what is called (Storage access framework) I don't know if it is related to the above intents or a new way to pick files? any thoughts? – Hasan Bou Taam Mar 02 '18 at 18:12
  • I think it's new way, completely different Intent and different way to get the actual results – Tuby Mar 02 '18 at 18:15
1

Yes, these intents are part of the standard Android. It is true that in some very rare cases the device manufacturer screwed this up, but the worse scenario is when the end user installs a 3rd party camera app, or an app that can work with Gallery. In this case, the system allows the end user to choose one of the apps that fulfill the intent. Some of these 3rd party apps don't fully comply with the protocol, or have unexpected side effects.

This is why the best practice is to have custom camera implementation in-app, for all apps that expect you to use the camera often enough.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
0

Yes this is basic functionality of android OS so that is build in all Android Device.

but after android version marshmallow you have to ask respective permission for it.

Pratik Satani
  • 1,115
  • 1
  • 9
  • 25