Logo
Beyond Single Features: Guaranteeing Camera Feature Combinations with CameraX

Beyond Single Features: Guaranteeing Camera Feature Combinations with CameraX

By Sagar Maiyad  Oct 17, 2025

When building camera applications for Android, developers often wonder: can I enable HDR video recording alongside 60 FPS capture on this device? What about adding preview stabilization to the mix? Until now, there's been no reliable way to verify whether multiple camera features can work together before attempting to use them.

The new Feature Group API in CameraX 1.5 changes everything. It provides developers with the tools to confidently combine camera features, knowing exactly what works on each device—delivering premium experiences on capable hardware while maintaining stability across the entire ecosystem.

For Those New to CameraX

CameraX is Jetpack's modern camera library designed to simplify camera development on Android. If you're just getting started, check out the official documentation and the CameraX codelab for a comprehensive introduction.

One of CameraX's biggest strengths is backward compatibility—it works on devices running Android 6.0 (API level 23) and higher, covering the vast majority of active Android devices today.

CameraX Overview 1 CameraX Overview 2

What You Can Build with the Feature Group API

The Feature Group API unlocks three powerful capabilities for your camera applications:

  • Create dynamic interfaces that respond to hardware capabilities, enabling or disabling features based on what the device actually supports
  • Implement "High-Quality" capture modes that automatically deliver the best possible combination of features without manual device detection
  • Prevent camera session failures by verifying feature compatibility before configuration, eliminating crashes from unsupported combinations

For example, on a Pixel 10 Pro with advanced camera hardware, your app could enable HDR recording at 60 FPS with preview stabilization active. On an older device with more limited capabilities, the same code gracefully falls back to a supported subset—perhaps just HDR recording—without any crashes or manual intervention.

Device Comparison

How It Works: The Core Components

The Feature Group API introduces three essential building blocks:

1. GroupableFeature enum

A predefined set of camera capabilities that can be reliably combined when hardware permits:

  • HDR_HLG10 - High Dynamic Range video in HLG10 format
  • FPS_60 - 60 frames per second video recording
  • PREVIEW_STABILIZATION - Real-time video stabilization
  • IMAGE_ULTRA_HDR - Ultra HDR image capture

2. SessionConfig parameters

Two new configuration options that control how features are requested:

  • requiredFeatureGroup - A set of features that must all be supported together; throws an exception if unavailable
  • preferredFeatureGroup - An ordered list of desired features; CameraX automatically selects the best-supported combination

3. CameraInfo#isFeatureGroupSupported() method

A query function that checks whether a specific combination of features works on the current device, enabling reactive UI updates based on hardware capabilities.

Implementation in Practice

Let's explore two practical scenarios that demonstrate the Feature Group API in action.

Scenario 1: "Best Effort" High-Quality Mode

Imagine you want to offer a high-quality recording mode that uses the best available features. With preferredFeatureGroup, you provide an ordered priority list, and CameraX automatically enables the highest-ranking combination the device supports:

cameraProvider.bindToLifecycle(
    lifecycleOwner,
    cameraSelector,
    preview,
    videoCapture,
    SessionConfig.defaultSessionConfig(
        preferredFeatureGroup = listOf(
            GroupableFeature.HDR_HLG10,
            GroupableFeature.FPS_60,
            GroupableFeature.PREVIEW_STABILIZATION
        )
    )
)

Here's how CameraX evaluates this request:

  1. First, it attempts all three features: HDR + 60 FPS + Stabilization
  2. If that fails, it tries HDR + 60 FPS
  3. If that fails, it tries HDR + Stabilization
  4. If that fails, it tries just HDR
  5. If that fails, it tries 60 FPS + Stabilization
  6. If that fails, it tries just 60 FPS
  7. If that fails, it tries just Stabilization
  8. If everything fails, it falls back to standard capture without any special features

This priority-based fallback ensures capable devices deliver premium experiences while maintaining compatibility everywhere else—all without writing complex device-detection logic.

Scenario 2: Building a Reactive UI

Sometimes you want to update your user interface based on what features are actually available. The isFeatureGroupSupported() method makes this straightforward:

// Helper function to identify unsupported features
fun getUnsupportedFeatures(
    cameraInfo: CameraInfo,
    requestedFeatures: Set<GroupableFeature>
): Set<GroupableFeature> {
    val unsupported = mutableSetOf<GroupableFeature>()

    for (feature in requestedFeatures) {
        if (!cameraInfo.isFeatureGroupSupported(setOf(feature))) {
            unsupported.add(feature)
        }
    }

    return unsupported
}

// Update UI when users toggle features
fun onFeatureChange(
    hdrEnabled: Boolean,
    fps60Enabled: Boolean,
    stabilizationEnabled: Boolean
) {
    val requestedFeatures = mutableSetOf<GroupableFeature>()

    if (hdrEnabled) requestedFeatures.add(GroupableFeature.HDR_HLG10)
    if (fps60Enabled) requestedFeatures.add(GroupableFeature.FPS_60)
    if (stabilizationEnabled) {
        requestedFeatures.add(GroupableFeature.PREVIEW_STABILIZATION)
    }

    // Check if the combination is supported
    val isSupported = cameraInfo.isFeatureGroupSupported(requestedFeatures)

    if (!isSupported) {
        // Find which specific features aren't supported
        val unsupported = getUnsupportedFeatures(cameraInfo, requestedFeatures)

        // Disable incompatible UI controls and show explanation
        showFeatureWarning("The following features aren't supported together: $unsupported")
    } else {
        // Enable capture button
        captureButton.isEnabled = true
    }
}

This approach creates an intelligent interface that guides users toward valid feature combinations, preventing confusion and frustration.

Get Started Today

The Feature Group API is available now as an experimental feature in CameraX 1.5 and is planned to reach full stability in CameraX 1.6. Even though it's marked experimental, the API is production-ready and unlikely to change significantly.

To begin using the Feature Group API in your project:

  1. Review the official documentation
  2. Add CameraX 1.5 dependencies to your build.gradle
  3. Start experimenting with preferredFeatureGroup and isFeatureGroupSupported()

Have feedback or questions? The CameraX team monitors the Android CameraX discussion group and the issue tracker for feature requests and bug reports.

We're excited to see what you build with reliable camera feature combinations!


Looking to implement advanced camera capabilities in your Android app? The Feature Group API provides the foundation for building camera experiences that adapt intelligently to hardware capabilities while maintaining rock-solid reliability across all devices.

Android CameraX Camera API

Author

Sagar Maiyad
Written By
Sagar Maiyad

Sagar Maiyad - Android Team Lead specializing in Kotlin, Jetpack Compose, Flutter, and Node.js development. Building practical Android apps with 2M+ downloads and sharing real-world development insights.

View All Posts →

Latest Post

Latest Tags