What We’ll Build
We’ll create a kiosk dashboard that:- Displays real-time battery level and charging status
- Shows device information and display metrics
- Controls screen brightness with a slider
- Monitors WiFi connectivity
Step-by-Step Guide
Add battery monitoring
Use
useBatteryLevel and useCharging to monitor power status:useBatteryLevel automatically updates when the battery level changes. The hook binds to the onBatteryLevelChanged event and cleans up automatically when the component unmounts.Add brightness control
Use
useScreenBrightness to display and control screen brightness:The brightness value ranges from 0 to 255, where 0 is the dimmest and 255 is the brightest. The
setBrightness function updates both the device brightness and the local state.Test in Fully Kiosk Browser
Build and deploy your application, then open it in Fully Kiosk Browser:
- Build your app:
npm run build - Host the build on a web server or locally
- Open the URL in Fully Kiosk Browser on your Android device
- Grant necessary permissions when prompted
Complete Example
Here’s the complete component code:KioskDashboard.tsx
Understanding the Code
Event Handling
Hooks likeuseBatteryLevel and useCharging automatically bind to Fully Kiosk events:
useBatteryLevellistens foronBatteryLevelChangedeventsuseCharginglistens forunplugged,pluggedAC,pluggedUSB, andpluggedWirelesseventsuseWifilistens fornetworkReconnectandnetworkDisconnectevents
State Management
Each hook manages its own internal state using React’suseState. When events fire, the state updates trigger re-renders of your component.
Control Functions
Hooks that control hardware (likeuseScreenBrightness and useWifi) return callback functions that you can use in event handlers. These functions interact directly with the Fully Kiosk API.
Next Steps
Now that you’ve built a basic kiosk dashboard, explore more advanced features:Device Information
Access device IDs, serial numbers, and hardware details
Screen Control
Control brightness, orientation, and screen power
Network Connectivity
Monitor WiFi, IP addresses, and network status
Hardware Integration
Integrate with battery, Bluetooth, NFC, and QR scanners
