CameraX
Make photography
easier on Android!
Bapusaheb Patil
Mobile Engineer & Meme Historian at Softway
www.bapspatil.com
Where I work...
Why CameraX?
val cameraIntent =
Intent(MediaStore.ACTION_IMAGE_CAPTURE)
val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
Not for camera-based
apps.
● Camera API
● Camera2 API
Camera API
The first-ever
API for camera
on Android! ✨
Simpler to setup than
Camera2…🤩
Simpler to setup than
Camera2...
...but no advanced camera
features. 😰
Cons...
Deprecated
since...
Camera2 API
A lot more complex to setup
than Camera API… 😰
A lot more complex to setup
than Camera API…
...but comes with advanced
features! 🤩
“Bapu, you told me this was
the coolest, latest Android API
for camera on the block.
Turns out it requires lot of
code! 🤬”
Way too many
callbacks.
Source: https://proandroiddev.com/understanding-camera2-api-from-callbacks-part-1-5d348de65950
Developers
have to test a
lot.
On a lot of
devices.
CameraX!
CameraX,
uses Camera2!
(under-the-hood)
API 21+
Camera2:
Too much control.
CameraX:
Use case based.
3 use cases
3 use cases
1. Preview
2. Analysis
3. Capture
1. Preview
Displaying the
image.
2. Analysis
Analyze the buffer
for, maybe, ML Kit?
3. Capture
Save your images.
Building a CameraX
app...
Sample app:
bit.ly/camerax-git
Don’t forget
permissions!
Setup your
(basic) UI.
Do NOT forget
permissions!
Setup
TextureView
for rotations.
Setup
CameraX!
Setup the
Preview.
Setup the
Analysis.
Setup the
Capture.
Bind
CameraX to
the lifecycle.
Let’s talk use cases.
Source: Android Developers
Camera360
Detect faces & add
filters.
CameraX fixes a lot
of issues. 👩‍⚕
CameraX simplifies
Camera2.
“Okay, Bapu, you’ve
impressed me with
CameraX. 😻
Where do I go from here?
🤔”
For more:
For more:
For more:
Now, go out
there & build
your first
CameraX app! 🤩
Bapusaheb Patil
Mobile Engineer & Meme Historian at Softway
Say hi to me! 👋
bapspatil
bapspatil.com
baps_patil 🤷‍♂
Find these slides at:
bit.ly/camerax-ppt

CameraX: Make photography easier on Android!