androidandroid-camerascreen-resolutionandroid-camera2android-resolution

How can I get the default size (in pixels) of a photo which will be captured through Android camera, before capturing it?


If it is determined by the resolution of the Android device's screen, is there a way to programatically get the value of that resolution?


Solution

  • If it is determined by the resolution of the Android device's screen

    No.

    How can I get the default size (in pixels) of a photo which will be captured through Android camera

    There is no "default size... of a photo".

    If you are using the android.hardware.Camera or android.hardware.camera2 APIs yourself, you need to specify the resolution that you want, from the available resolutions.

    If you are using ACTION_IMAGE_CAPTURE, the resolution will be based in part on whether you pass EXTRA_OUTPUT or not, but otherwise is up to the camera app. There are thousands of Android device models, shipping with hundreds of different pre-installed camera apps, and there are many other camera apps available through distribution channels like the Play Store. They will be using the android.hardware.Camera or android.hardware.camera2 APIs, and they will choose what resolution they want to use, by whatever algorithm they want.