Android Camera Integration to Take Photos (including Android 10, API 29)- Kotlin Tutorial

Build an app which integrates camera functionality, allowing the user to take a picture and display that image in our app. We’ll be using an external camera application to capture the image rather than integrating the camera directly into our app.

Note: you don’t actually need the READ_EXTERNAL_STORAGE permission! See this video: Thanks to Bhusan S for pointing this out.

Follow me on Twitter:

Guides about integrating…

Similar Posts

23 thoughts on “Android Camera Integration to Take Photos (including Android 10, API 29)- Kotlin Tutorial
  1. Timestamps if you want to jump to a particular spot in the video:
    0:38– Two ways to integrate camera functionality in your app
    2:12– How to get the image if you’re ok with a low quality image
    5:14– Handling onActivityResult once the user has taken a picture with the camera
    7:06– Demo of app capturing the low quality image
    7:45– How to get a high quality image from the camera
    10:33– Introducing the file provider to securely pass the file to the camera app
    14:15– Demo of app capturing the high quality image

  2. I am getting this error in Android 10 device – MIME type Image/jpg cannot be inserted into content://media/external/images/media; expected MIME type under image/*

  3. Hi, is there any tutorial using this ? registerForActivityResult(TakePicture()), because startForActivityResut is no used anymore… my question is if the Uri parameter is mandatory, so I need to declare the file name before invoking the Intent …

  4. How can i now acces the takenImage val in another function?
    Since you can't use the variable takenImage in another function, since its only in the onAcitivityResult function if I'm not mistaken.
    So let's say I want to use the Image we created and pass it into the TextRecognition function from ML Kit.

  5. btnTakePicture.setOnClickListener …why i not able to use this directly as you have used? I can only use setOnClickListener after using fingViewbyId(it has happened before in many other projects). Do i need to do something to use setOnClickListener directly without using findViewbyid ?

  6. Hello ! Thanks for the video but I am having a problem. The ".setImageBitmap" is red in my code and it doesn't recognize the command. I am completetly new to this so pls help me.

  7. Awesome tutorial! Thank you, I learned a lot in a short amount of time here.

    Question.. I know it would certainly take some effort and time to do, but have you ever considered doing one on CameraX and exploiting the camera for some interesting sensor data or even just making an app that incorporates the camera as part of a camera app with more features? Maybe something that has a very basic filter / frame rate setting / time lapse component?

  8. Hi Rahul. If we render the complete large sized image into an imageview, won't that have any performance implications? What would be the workaround then, if on one hand you need the file path but on the other hand, display a low quality image in the UI?

Leave a Reply

Your email address will not be published. Required fields are marked *