Google Play services offers the Google Low Light Boost library. This library allows apps to dynamically adjust the camera's brightness in real time to adapt to low light conditions, even when running on devices that don't support Low Light Boost AE Mode.
We provide several different ways to capture images in low-light conditions. To choose the right approach for your app's needs, see Choose the best low light option.
Key interfaces
There are two main interfaces you need to know about to use Google Low Light Boost:
LowLightBoostClient
lets you confirm that the module is installed from Google Play services, and install the module if necessary. You also use the client to create aLowLightBoostSession
.LowLightBoostSession
manages the necessary input surfaces and outputs the brightened camera preview to the surface provided by the app. You useLowLightBoostSession
to turn low light boost on or off.
Google Low Light Boost workflow
To provide preview images in low light conditions, follow this sequence:
- Check whether the device you're on supports Low Light Boost AE Mode. If the device supports Low Light Boost AE Mode, use it instead of Google Low Light Boost.
- Create a Camera2 session. Software LLB works with the Camera2 APIs.
- Create a
LowLightBoostClient
. This object provides essential utilities you'll need to use Google Low Light Boost. - Check if the low light boost module is installed. Google Low Light Boost is provided by Google Play services, so you'll need to check whether it's already installed on the device. If it isn't, you'll need to install the module.
- Confirm that the device camera supports Google Low Light Boost.
- Create a
LowLightBoostSession
. This object lets you turn low light mode on and off. - Preview or record video the way you normally would with Camera2.
- When the camera is no longer active, release the session.