Zebra CS60 and CS60-HC Series Companion Scanner Zebra Scanner SDK for Android Developer Guide (en)

ZEBRA SCANNER SDK for ANDROID DEVELOPER GUIDE
ZEBRA SCANNER SDK for ANDROID
DEVELOPER GUIDE
MN002223A06
Revision A
May 2019
ii Zebra Scanner SDK for Android Developer Guide
The software is provided strictly on an “as is” basis. All software, including firmware, furnished to the user is on a licensed basis. Zebra grants to the user a non-transferable and non-exclusive license to use each software or firmware program delivered hereunder (licensed program). Except as noted below, such license may not be assigned, sublicensed, or otherwise transferred by the user without prior written consent of Zebra. No right to copy a licensed program in whole or in part is granted, except as permitted under copyright law. The user shall not modify, merge, or incorporate any form or portion of a licensed program with other program material, create a derivative work from a licensed program, or use a licensed program in a network without written permission from Zebra. The user agrees to maintain Zebra’s copyright notice on the licensed programs delivered hereunder, and to include the same on any authorized copies it makes, in whole or in part. The user agrees not to decompile, disassemble, decode, or reverse engineer any licensed program delivered to the user or any portion thereof.
Zebra reserves the right to make changes to any software or product to improve reliability, function, or design. Zebra does not assume any product liability arising out of, or in connection with, the application or use of any product, circuit, or application described herein.
No license is granted, either expressly or by implication, estoppel, or otherwise under any Zebra Technologies Corporation, intellectual property rights. An implied license only exists for equipment, circuits, and subsystems contained in Zebra products.

Warranty

For the complete Zebra hardware product warranty statement, go to:
http://www.zebra.com/warranty

Revision History

Changes to the original manual are listed below:
Change Date Description
-01 Rev A 8/2015 Initial Release
-02 Rev A 10/2015 Software updates.
-03 Rev A 9/2016 Software updates.
-04 Rev A 4/2017 Software updates.
-05 Rev A 11/2018 Deleted EOL scanners; added new scanners.
-06 Rev A 5/2019 Updated:
.
- supported scanners list on pg. 1-2
- Android version on pg. 1-3
- Zebra copyright statement on the last page.
Added Scale Functionality on pg. 2-15.

TABLE OF CONTENTS

Warranty ......................................................................................................................................... ii
Revision History .............................................................................................................................. ii
About This Guide
Introduction ..................................................................................................................................... v
Chapter Descriptions ...................................................................................................................... v
Related Documents ........................................................................................................................ v
Additional Resources...................................................................................................................... vi
Notational Conventions................................................................................................................... vi
Service Information ......................................................................................................................... vi
Chapter 1: GETTING STARTED with the ZEBRA SCANNER SDK for ANDROID
Introduction .................................................................................................................................... 1-1
Overview of the Zebra Scanner SDK for Android .......................................................................... 1-1
Supported Scanners ................................................................................................................ 1-2
System Requirements .............................................................................................................. 1-3
Installation and Configuration ........................................................................................................ 1-3
Installing the Scanner Control Application ............................................................................... 1-3
Running and Configuring the Scanner Control Application ...................................................... 1-4
Using Scanner Control Application with a Supported Device .................................................. 1-7
Setting Up the Zebra Scanner SDK for Android in Android Studio ................................................ 1-16
Prerequisite 1 - Installation of Android Studio .......................................................................... 1-16
Prerequisite 2 - Configuring the Host to Communicate With the Device ................................. 1-16
Installing and Building the Android SDK Project ...................................................................... 1-16
Chapter 2: ANDROID DEVELOPMENT SDK
Introduction .................................................................................................................................... 2-1
Initialization .................................................................................................................................... 2-1
SDK Initialization ...................................................................................................................... 2-1
Setting SDK Handler Delegate ................................................................................................ 2-2
Setting Operation Mode ........................................................................................................... 2-2
iv Zebra Scanner SDK for Android Developer Guide
Subscribing to Events .............................................................................................................. 2-3
Connecting to a Scanner ............................................................................................................... 2-4
Detecting Available Scanners .................................................................................................. 2-4
Connecting to an Available Scanner ........................................................................................ 2-5
Receiving Bar Code Data .............................................................................................................. 2-7
Retrieving Scanner Attributes ........................................................................................................ 2-8
Sending Remote Commands ......................................................................................................... 2-12
Beep the Beeper ...................................................................................................................... 2-12
Disabling a Bar Code Symbology Type ................................................................................... 2-13
Disabling the Scanner .............................................................................................................. 2-14
Update Scanner Firmware ............................................................................................................. 2-15
Scale Functionality ......................................................................................................................... 2-15
Scale Enable/Disable ............................................................................................................... 2-15
Zero Scale ................................................................................................................................ 2-16
Reset Scale .............................................................................................................................. 2-16
Read Weight ............................................................................................................................ 2-16

ABOUT THIS GUIDE

Introduction

The Zebra Scanner SDK for Android Developer Guide provides installation and programming information for the
Software Developer Kit (SDK) that allows Software Decode based applications for Android based devices.

Chapter Descriptions

This guide includes the following topics:
Chapter 1, GETTING STARTED with the ZEBRA SCANNER SDK for ANDROID provides information about
the Android Software Development Kit (Android SDK).
Chapter 2, ANDROID DEVELOPMENT SDK describes how to connect to a scanner through the SDK,
retrieve bar codes, and send command and control messages using the included application as an example.

Related Documents

RFD8500 Developer Guide, p/n MN002222Axx.
Zebra Scanner SDK for iOS Developer Guide, p/n MN001834Axx.
RFD8500 User Guide, p/n MN002065Axx.
RFD8500 Quick Start Guide, p/n MN002225Axx.
RFD8500 Regulatory Guide, p/n MN002062Axx.
CRD1S-RFD8500 (1-Slot), CRDUNIV-RFD8500-1R (3-Slot), CRD4S-RFD8500 (4-Slot) Universal Charge Only Cradles Regulatory Guide, p/n MN002224Axx.
DS3678 Cordless Digital Imager Product Reference Guide, p/n MN-002689-xx.
CS4070 Product Reference Guide, p/n MN000762Axx.
For the latest version of this guide and all guides, go to: www.zebra.com/support
.
vi Zebra Scanner SDK for Android Developer Guide

Additional Resources

For further information on the various topics covered in this Developer Guide, also refer to:
Android Studio Overview at http://developer.android.com/tools/studio/index.html
Android Studio Training and Samples at https://developer.android.com/training/index.html
Android API Guides at http://developer.android.com/guide/index.html

Notational Conventions

This document uses the following conventions:
Italics are used to highlight chapters, sections, field names, and screen names in this and related
documents.
Courier New font type is used to represent code snippets.
bullets (•) indicate:
Action items
Lists of alternatives
Lists of required steps that are not necessarily sequential
Sequential lists (e.g., those that describe step-by-step procedures) appear as numbered lists.
NOTE This symbol indicates something of special interest or importance to the reader. Failure to read the note
does not result in physical harm to the reader, equipment or data.
CAUTION This symbol indicates that if this information is ignored, the possibility of data or material damage may
occur.
WARNING! This symbol indicates that if this information is ignored the possibility that serious personal

Service Information

If you have a problem using the equipment, contact your facility's technical or systems support. If there is a
problem with the equipment, they contact the Zebra Technologies Global Customer Support Center at:
http://www.zebra.com/support
When contacting Zebra support, please have the following information available:
Product name
Version number
Zebra responds to calls by e-mail, telephone or fax within the time limits set forth in support agreements.
injury may occur.
.
will be given specific directions. Zebra is not responsible for any damages incurred during shipment if the
approved shipping container is not used. Shipping the units improperly can possibly void the warranty.
If you purchased your business product from a Zebra business partner, contact that business partner for
support.
Chapter 1 GETTING STARTED with the
ZEBRA SCANNER SDK for ANDROID

Introduction

This chapter provides information about the Zebra Scanner SDK for Android - an architectural framework providing a single programming interface to provide two way communication between Android based applications and supported Zebra scanning devices.

Overview of the Zebra Scanner SDK for Android

The Android SDK provides an abstraction layer, delivered in the form of an Android Library (.aar file). This library provides an API to provide the connection, command and control, and communication facilities required to operate a Zebra scanner on the Android platform.
The Android SDK is broken into three parts:
Scanner Control Application for Android - Installable application for Android devices to enable quick
testing and demonstration of the SDK capabilities on a Bluetooth USB SNAPI scanner. The Scanner Control application is available for download from the Google Play Store and is distributed within the SDK.
®
(BT) supported Zebra scanner or a
Android SDK Library File - This is provided as standalone AAR file that can be imported into a new
Android Application. Android Studio is the development environment that is recommended.
Android SDK Demo Application Project - This is a zip file containing the Scanner Control application
project files from Android Studio. It contains the source code to the application and the SDK library files necessary to build, test and modify the application as necessary.
1 - 2 Zebra Scanner SDK for Android Developer Guide

Supported Scanners

Currently the following Zebra scanners are supported:
USB SNAPI
PL3307
DS457
DS4308
LS2208
DS8178 and Presentation Cradle
DS3678 and Presentation Cradle
MP6210 (CSS + Scale) + EAS (Sensormatic)
MP7000.
Bluetooth
CS4070 (in Bluetooth SSI Profile mode)
RFD8500 (in default mode)
DS3678 (In SSI BT Classic mode)
LI3678 (In SSI BT Classic mode).
DS8178 (In SSI BT Classic mode)
DS2278 (In SSI BT Classic mode).
NOTE To configure a device in the mode specified, refer to the appropriate Product Reference Guide, User
Guide, or Integration Guide.
Table 1-1 lists the pairing methods that can be used for each scanner model.
Table 1-1
CS4070 Yes Yes
DS3678 Yes Yes
LI3678 Yes Yes
DS8178 Yes Yes
Pairing Methods
Scanner Model
Scan-To-Connect Pairing
Bar Code
Manual Pairing
DS2278 Yes Yes
RFD8500 Yes
GETTING STARTED with the ZEBRA SCANNER SDK for ANDROID 1 - 3

System Requirements

The following system requirements are necessary to use the Scanner Control application (demo application).
Hardware device supporting Android KitKat version 4.4, or later, with Bluetooth and USB port (only if using USB scanners).
NOTE Android version Pie (9.0) is the latest version that was tested.
The following system requirements are necessary to develop and test applications, and to use the Scanner Control application project for development and testing.
Android Studio 1.3 or later installed on Windows or Linux
Android API Level 19 or later (Demo application was built and tested with API Level 19)
The Scanner Control Application Project (packaged as an Android Studio Project)
Hardware device running Android Kit Kat 4.4 or later, or emulator. Note that in order to create a connection to the scanner, a Bluetooth connection is required.

Installation and Configuration

Installing the Scanner Control Application

The Scanner Control application can be installed directly onto a mobile device. The following steps include general guidelines for installation. Menus and options may vary depending on the version of Android running.
NOTE The Scanner Control application is available for download from the Google Play Store and is distributed
within the SDK.
To install the demo application:
1. Previous versions (earlier than v1.0.16.0 of the Zebra Scanner Control application used a different name
and branding signature and must be manually uninstalled before installing the current version of the SDK demo application.
To do this:
a. Go to Android Settings > Application Manager (this varies depending on the version and platform of
Android running).
b. Select the Android Scanner Demo App. c. Select Clear Cache and Clear Data to remove any resident demo settings. d. Select Uninstall to remove the demo application from the system.
2. Install the application using one of the following methods:
a. Using Google Play Store:
i. Go to https://play.google.com/store/apps/details?id=com.zebra.scannercontrol.app or search for
Scanner Control in Google Play Store.
ii. Install the Scanner Control application.
or
b. Manual Installation from the SDK package:
1 - 4 Zebra Scanner SDK for Android Developer Guide
i. Copy the file scanner_control_app_version.apk file included with the SDK package to the Android
device.
ii. Navigate to the saved location and select the APK package file.
iii. The Android OS provides a warning that the application is from an untrusted source and requires
that installation from unknown sources be enabled for this installation. This is normal. Select the option to install from unknown sources.
3. The Android OS installs the application and installs a Scanner Control Application icon ( ) in the
Apps menu.

Running and Configuring the Scanner Control Application

To run the application:
1. Select the Scanner Control application from the Android App menu.
2. After the splash screen appears, the overview message screen displays (Figure 1-1).
Figure 1-1
3. Select CONTINUE. The Pair New Scanner bar code displays.
Scanner Control App - Overview
GETTING STARTED with the ZEBRA SCANNER SDK for ANDROID 1 - 5
4. From the Scanner Control App, select App Settings to configure the application.
Figure 1-2
5. The available settings are displayed in Figure 1-3. See Table 1-2 for settings descriptions.
Scanner Control App Menu - App Settings
Figure 1-3
App Settings
1 - 6 Zebra Scanner SDK for Android Developer Guide
Table 1-2
Reset Defaults Changes all settings to the defaults.
Background Notifications
Available Scanner Notifies the user when a new scanner is available for
Active Scanner Notifies the user when a scanner becomes connected.
Barcode Event Notifies the user when a bar code scans.
Scanner Detection
Auto Detection Automatically detects new scanners when they are paired or
Pair New Scanner Bar Code
Communication Protocol Communication protocol to be used in ScanToConnect Suite
Set Factory Defaults Determines whether or not the scanner changes its settings to
App Settings Descriptions
Setting Description
connection.
connected via USB.
bar code. Application can connect only in the SSI over Bluetooth Classic protocol.
factory defaults before connecting.
Loading...
+ 30 hidden pages