> ## Documentation Index
> Fetch the complete documentation index at: https://setup.despia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Screen Brightness

> Control device scanning behavior with configurable modes (auto, on, off) and automatic screen brightness adjustment through your Lovable mobile app using the Despia SDK.

<iframe src="https://www.youtube.com/embed/lP9ZkgGYcEE" title="YouTube video player" frameborder="0" className="w-full aspect-video rounded-xl" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen />

<Card title="Lovable Prompt" icon="sparkles">
  Add scanning mode control functionality to my app using the Despia SDK from: [https://www.npmjs.com/package/despia-native](https://www.npmjs.com/package/despia-native)

  First, install the package: `npm install despia-native`

  Then import it: `import despia from 'despia-native'`

  Create a scanning mode control system that uses Despia URLs like: ``despia(`scanningmode://${mode}`)`` where mode can be "auto", "on", or "off" to control device scanning behavior and automatically adjust screen brightness for optimal scanning conditions.

  <Danger>
    **This feature requires native capabilities which will be fully provided by the "despia-native" npm package, no additional native libraries are needed!**
  </Danger>

  Please follow the installation instructions for the "despia-native" npm package closely, and do not modify my instructions. Implementation as mentioned is critical.
</Card>

**How it works:** Despia acts as a bridge between your Lovable app and native mobile scanning systems. When triggered, Despia controls the device's scanning behavior through native APIs and automatically adjusts screen brightness to make scanning easier and more accurate. The system optimizes display conditions for various device sensors and detection capabilities.

## Installation

Install the Despia package from NPM:

```
npm install despia-native
```

## Usage

### 1. Import the SDK

```javascript theme={null}
import despia from 'despia-native';
```

### 2. Control Scanning Mode

Define your scanning mode:

```javascript theme={null}
const mode = "auto" // auto, off, or on
```

Call the despia() function with a Scanning Mode Command:

```javascript theme={null}
despia(`scanningmode://${mode}`)
```

**Available Modes:**

* `"auto"` - Automatically manages scanning and brightness based on device conditions
* `"on"` - Forces scanning to remain active with optimized screen brightness
* `"off"` - Disables scanning functionality and restores normal brightness

**Background Scanning Features:**

* Automatically adjusts screen brightness for optimal scanning conditions
* Maintains scanning capabilities even when app is in background
* Intelligently manages battery usage during extended scanning sessions
* Provides enhanced contrast and visibility for barcode/QR code detection

## **Resources**

* [**NPM Package**](https://www.npmjs.com/package/despia-native)
* View full NPM documentation for additional configuration options

### **Lovable Integration**

This SDK is optimized for Lovable's prompt-based AI builder, enabling quick integration of native file sharing capabilities into your generated apps.

For additional support or questions, please contact our support team at [support@despia.com](mailto:support@despia.com)
