A multi-functional scanning application developed based on HarmonyOS, supporting various scanning modes such as QR code, barcode, document, and providing user profile center functionality.
|
Application Framework |
Development Language |
UI Framework |
|
Development Tool |
Mobile Services |
Data Storage |
|
|
|
|
|
|
|
.app file package (containing .hap and .info) from the releases.app file using the file manager on your HarmonyOS device and tap to installhdc command-line tool:
hdc install <path-to-app-file>
Prepare the development environment:
# Check Node.js version
node -v # Should be 14.0 or higher
# Check JDK version
java -version # Should be 1.8 or higher
Clone the repository:
git clone https://github.com/your-repo/harmony-scan-app.git
cd harmony-scan-app
Open the project with DevEco Studio:
File -> OpenBuild and install:
Build -> Build Hap(s)/APP(s) -> Build Hap(s) in the top menuRelease modeVerify installation:
Installation failures:
Build errors:
Build -> Clean ProjectPermission issues:
Mobile devices:
Tablet devices:
This application utilizes HarmonyOS's responsive layout system, with careful optimizations for different device characteristics:
MediaQueryscreenDensityFlex layoutGridRow and GridColbreakpointsTablet interface features a dual-column layout, providing larger display area and richer operation space
Left: Main Layout - Dual-column design with navigation on the left and content area on the right
Right: Scanning Interface - Optimized viewfinder and intuitive operation buttons
Mobile interface adopts a compact single-column layout for optimal mobile experience
Left to Right: Home Screen - Quick Access | Scanning Interface - Optimized Experience | History Records - Timeline View
Left to Right: User Profile - Information Overview | Settings - Feature Configuration | Scan Results - Instant Processing
// Responsive Layout Example
@Component
struct ResponsiveLayout {
@State deviceType: string = 'phone'
aboutToAppear() {
// Detect device type
this.deviceType = this.getDeviceType()
}
// Device type detection
getDeviceType() {
return px2vp(screenWidth) >= 600 ? 'tablet' : 'phone'
}
build() {
Column() {
if (this.deviceType === 'tablet') {
// Tablet layout
Row() {
// Sidebar navigation
Column() {
// Navigation content
}
.width('30%')
// Main content area
Column() {
// Page content
}
.width('70%')
}
} else {
// Mobile layout
Column() {
// Page content
// Bottom navigation bar
}
}
}
}
}
A: Currently supports QR codes, barcodes (EAN-13, UPC-A, Code 39, etc.), Data Matrix, and PDF417.
A: By default, history is stored permanently locally unless manually deleted or app data is cleared.
A: Click the flashlight icon in the scanning interface to enable device flash for assistance.
A: Yes, basic scanning functions work offline, but some advanced features (like product info lookup) require network connection.
A: In the history page, click the menu button in the top right and select "Export Data", then choose export format.
Pull Requests and Issues are welcome. Before submitting code, please ensure:
This project is licensed under the MIT License - see the LICENSE file for details