This Android application allows users to generate QR codes containing MAC address information and scan QR codes to retrieve the embedded data. The project follows Clean Architecture, MVVM pattern, and uses modern Android development tools like Hilt for dependency injection, Kotlin Coroutines, and Jetpack libraries.
- Generates a QR code containing the device's MAC address and a timestamp
- Displays the generated QR code on the screen
- Scans QR codes and extracts the embedded MAC address and timestamp
- Displays the scanned data on the screen
- Separates the project into Data, Domain, and Presentation layers for better maintainability and testability
- Uses Hilt for dependency injection to manage dependencies across the app
- Follows the Model-View-ViewModel pattern to separate UI logic from business logic
- Includes unit tests for ViewModels, Use Cases, and Repositories
- Kotlin: Primary programming language
- Hilt: For dependency injection
- ZXing: For QR code generation and scanning
- Jetpack Libraries:
- ViewModel
- LiveData
- StateFlow
- Activity/Fragment KTX
- Coroutines: For asynchronous programming
- Material Design: For UI components and theming
The project is organized into the following layers:
Contains the data sources (local, remote) and repository implementations.
Files:
- MacRepositoryImpl.kt
- QrCodeDataSource.kt
Contains the business logic, use cases, and repository interfaces.
Files:
- MacInfo.kt
- GenerateQrUseCase.kt
- MacRepository.kt
Contains UI components (Activities, Fragments, ViewModels) and UI logic.
Files:
- GeneratorActivity.kt
- ScannerActivity.kt
- QrGeneratorViewModel.kt
- QrScannerViewModel.kt
Contains Hilt modules for dependency injection.
Files:
- AppModule.kt
- Android Studio (latest stable version)
- Android SDK (API level 24 or higher)
- Kotlin plugin (installed by default in Android Studio)
- Clone the Repository:
git clone https://github.com/satdevkumar01/qr-code-generator-scanner.git
-
Open the Project:
- Open Android Studio and select Open an Existing Project
- Navigate to the cloned repository and select the project
-
Build the Project:
- Click on Build > Make Project to build the project and resolve dependencies
-
Run the Project:
- Connect an Android device or start an emulator
- Click on Run > Run 'app' to install and launch the app
The app requires the following permissions:
Used for scanning QR codes.
Add the following to AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA"/>
Used to retrieve the device's MAC address.
Add the following to AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
The project includes unit tests for ViewModels, Use Cases, and Repositories. To run the tests:
- Open the test folder in the src directory
- Right-click on the test file and select Run
The project uses the following dependencies:
- Hilt: For dependency injection
- ZXing: For QR code generation and scanning
- Jetpack Libraries: For ViewModel, LiveData, and StateFlow
- Coroutines: For asynchronous programming
- Material Design: For UI components
See the build.gradle.kts files for the complete list of dependencies.
[Include screenshots of the app here]
Contributions are welcome! If you find any issues or want to add new features, feel free to open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or feedback, please contact:
- Your Name: satdevsokhal1995@gmail.com
- GitHub: satdevkumar01