This sample project shows you how to use RealWear's Barcode Reader in an Android web app, receiving the scan result in JavaScript.
- You require node.js version 16 or above or running the Vue app fails.
- To install it on Windows:
- Install nvm via this link https://github.com/coreybutler/nvm-windows/releases
- In Command Prompt, use
nvm ls
. You should have an asterisk next to a node version that is 16 or higher.
- To install it on Windows:
cd vue-project
npm install
npm run build
- Open this folder in Android Studio and proceed as normal to build and run on your device.
This sample project has hot reloading setup. When you set it up and run npm run dev-android
, any changes to files
in Vue will cause the app to re-build and deploy instantly onto your chosen device.
To setup hot reloading:
- Ensure you've ran the above steps for building the web app, to confirm you have installed the node.js dependency.
- Your system environment needs to have Java 11 (64-bit) setup, with a path to it linked to env variable 'JAVA_HOME'.
- For convenience, we use the Java distribution configured with Android Studio. You can find the path to this in
File > Project Structure > SDK Location > Gradle Settings
and reading the path set onGradle JDK
. Usually, the path for Windows isC:/Program Files/Android/Android Studio/jre
. - In Command Prompt, run
set JAVA_HOME="C:/Program Files/Android/Android Studio/jre"
(replace with your directory if different) each time you want to run hot reloading.- If using PowerShell, instead run
$env:JAVA_HOME = "C:/Program Files/Android/Android Studio/jre"
. - If using Bash, instead run
export JAVA_HOME="C:/Program Files/Android/Android Studio/jre"
. - For ease of use, consider setting the env variable permanently in your system environment variables (if you choose this option, remember to close and re-open your command prompt).
- If using PowerShell, instead run
- For convenience, we use the Java distribution configured with Android Studio. You can find the path to this in
cd vue-project
npm install
npm run dev-android