
Add scanning mode control functionality to my app using the Despia SDK from: 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.
This feature requires native capabilities which will be fully provided by the "despia-native" npm package, no additional native libraries are needed!
Please follow the installation instructions for the "despia-native" npm package closely, and do not modify my instructions. Implementation as mentioned is critical.
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
import despia from 'despia-native';
2. Control Scanning Mode
Define your scanning mode:
const mode = "auto" // auto, off, or on
Call the despia() function with a Scanning Mode Command:
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
-
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