> Sample App

Sample App

Last updated on July 2, 2012

Building the sample application

Developers who have downloaded the SDK in order to evaluate it usually just want to check out how well scanning works. The fastest way to do that is to build the included Sample application in your favorite build environment and install it on your Android device.

To try out the Sample app, you’ll need to build it. You can either build with Eclipse, or directly from the command line. Building from the command line requires that you have the Android SDK from Google and the Apache Ant build tool installed on your computer.

To build from the command line, run the following 3 commands from the RLSample directory:

RLSample$ android update project --path .
RLSample$ ant debug
RLSample$ adb install bin/RLSample-debug.apk

The first command should create your local.properties file, which locates your Android SDK directory for ant. The second command builds the sample application. The third command installs the application on a connected Android device. Running on the emulator isn’t supported; without a simulated camera there’s nothing for the SDK to do anyway.

If the first command fails for some reason, you can manually copy the “local.properties–Recommended” file to local.properties and edit it to set up the sdk.dir property to point to your Android SDK folder.

The RLSample project is designed to build against Android API level 7. If API 7 isn’t installed on your computer, the ‘ant debug’ command will probably fail–either install API 7 on your computer or specify a newer Android API platform that is installed.

To build from Eclipse,

  1. Choose “Import…->Existing Projects into Workspace”
  2. Navigate to the RLSample folder, and select it for importing
  3. Build and run the project on your device.

The SDK *can* be run on the Android emulator, but we don’t recommend it, and can’t support it.

Running the sample application

RLSample demonstrates some of RedLaser’s capabilities, and is intended as an introduction and starting point for development with RedLaser. However, RLSample should not be confused with the entire SDK, which has significant additional functionality.

The sample application includes the following features:

Main Screen

This is the screen you see when you start up the sample application. It gives access to the scan screen as well as the options screen. In addition, when you are done scanning, scan results will be displayed on this screen.

Single Scan Button This button will bring you to the scan screen using single scan mode. After scanning at least one barcode the scan screen will automatically return to the main screen and display the result(s).

Multi-Scan Button This button will bring you to the scan screen using multiple scan mode. You may scan any number of barcodes until you choose to complete the scan session. When finished, the scan screen will return to the main screen and all the results will be displayed.

Options Button This button will bring you to the options screen.

Clear List Button Use this button to clear all of the scan results from the main screen.

 

Options Screen


This screen allows you to set various scan options available in the sample application. These options include barcode types and scan screen, orientation.

Barcode Types These toggle buttons allow you to enable or disable any number of barcode types. Note that if no types are selected, then the scanner will not recognize any codes. Also note that toggling more barcode types can decrease scanning speed.

Orientation Use this button to set the orientation of the scan screen. The orientation is set to portrait by default, but landscape can be useful for longer barcodes such as Code 39.

 

Scan Screen


This is the screen used to scan actual barcodes. It is the same for both single and multi scanning.

Hint Text This text assists the user by instructing them to either align the barcode within the viewfinder or hold the camera still. This displays above the viewfinder.

Viewfinder This box is used to guide the user so they know where to place the barcode being scanned.

Barcodes Found Text This text keeps track of how many barcodes have been scanned. It is useful in multiple-scan mode so the user can see how many barcodes have been successfully scanned.

Light Button This button turns on the flash if supported.

Get Image Button Stores an image of the camera view locally on the device.

Done Button This button should be pressed when the user wants to end the scan session. After this button is pressed, the scan screen will exit and all scanned barcodes will be loaded onto the main screen.



Download RedLaser

  • iPhone
  • Android
  • Windows Phone