Camera Focus Behavior

This page describes how the camera focus works in the Anyline Mobile SDK for Android, helping you understand what your users will experience when scanning.

Overview

The Anyline Mobile SDK for Android provides an intelligent camera focus system that combines automatic focus with manual tap-to-focus functionality, designed to provide optimal scanning performance while giving users control when needed.

Focus Modes

The SDK uses two focus modes that work together:

Continuous Autofocus (Default)

  • What it does: The camera continuously adjusts focus automatically as the scene changes

  • When it’s active: This is the default mode when the camera starts and after tap-to-focus times out

  • How it works: The SDK automatically selects the best continuous focus mode based on your device’s capabilities

  • Best for: General scanning scenarios where users are moving the device or scanning at different distances

Tap-to-Focus

  • What it does: The camera focuses on a specific point when the user taps the screen

  • When it’s active: Immediately after a user taps anywhere on the camera preview

  • Best for: Precise focusing on specific areas or when automatic focus is struggling

Focus Behavior Sequence

Here’s what happens when users interact with the camera:

  1. Camera starts: Continuous autofocus is active by default

  2. User taps screen: Camera immediately focuses on the tap location and switches to manual focus mode

  3. 5-second timeout: After 5 seconds, the camera automatically returns to continuous autofocus mode

  4. Multiple taps: If the user taps again during the 5-second period, the timer resets and starts over

Best Practices

When to Encourage Tap-to-Focus

Inform your users that tap-to-focus is helpful in these situations:

  • Difficult lighting conditions: When automatic focus struggles with low light or high contrast

  • Specific document areas: When focusing on a particular part of a document or object

  • Close-up scanning: When scanning small text or details that require precise focus

  • Struggling autofocus: When the continuous autofocus appears to be "hunting" or unstable

When to Rely on Continuous Autofocus

For most scanning scenarios, continuous autofocus works well:

  • General scanning: When users are moving the device naturally during scanning

  • Multiple objects: When scanning multiple items in sequence

  • Variable distances: When the scanning distance changes frequently

Troubleshooting

Focus Appears Not to Work

  • Ensure there’s sufficient light for the camera to determine focus

  • Check that the scanning area is not too close (closer than ~10cm) or too far (farther than ~1m) from the optimal focus range

  • Some very reflective or low-contrast surfaces may be difficult for any autofocus system

  • Older devices may have limitations with continuous autofocus modes

Focus Performance Varies by Device

  • Different Android devices have different camera capabilities and focus performance

  • The SDK automatically optimizes focus behavior based on the device’s capabilities

  • Some devices perform better with different focus modes, but this is handled automatically

Users Expect Immediate Return to Autofocus

  • The 5-second timeout is designed to give users time to make fine adjustments after tapping

  • This prevents the camera from constantly switching between focus modes during normal use

  • Consider this behavior when designing your user interface and user guidance

Important Notes

The focus behavior described here is built into the SDK and cannot be configured or changed through JSON configuration files or SDK settings. The 5-second timeout and focus modes are consistent across all implementations, though the SDK automatically optimizes the specific focus mode based on device capabilities.