"We are committed to providing our Customers with excellent software solutions.
We can handle everything - complex business, mobile, game, web applications and present perfect result at the end," Dmitry Starostenkov, CEO
 
click to start a new project
start live dialog with Enterra
 
News
About Us
Portfolio
Clients
Contact
Tech Zone

Use of barcodes in mobile applications

The article is based on the real experience in development of a certain mobile application which uses barcodes.

What are barcodes?

According to wikipedia.org, barcode – is " a sequence of black and white stripes, representing some of the information in a form, suitable for reading by technical means. There are several types: linear (conventional) – known as bar codes which are read in one direction (horizontally); 2 dimensional (2D barcodes) – known as symbols, designed to encode large amounts of information". The first can be seen on any product in the store, while the latter can be found in promotional flyers, business cards, magazines.

Currently, barcodes are becoming more and more common. The main reason is that they serve as a convenient means of communication. This storage medium can be almost any object, and the recipient – a mobile device that has a camera and special software.

Data transmission occurs in several stages: the creation of barcode encoded with information, distribution barcode and reading barcode.

Creating barcodes

Links to Internet sites are the most common information that is encoded in barcodes. However, it is possible to encode any data. Therefore, the popular information also can be: data from a business card, name, date and time of meeting or event, location (longitude and width), just text, phone number, and much more. For such data, common formats are used: for business cards there are electronic analogues: vCard, meCard, BIZCARD, for events – iCalendar, vCalendar.

It is also necessary to consider the following thing: sometimes it is inconvenient to put information directly in the barcode. Then the data is saved on the server, and a barcode stores a reference to these data (in this case, the barcode is not independent). Their advantages are:

  • data is always current (when data is changed, it is not required to change the barcode, so as all the items on which it was put);
  • the smaller barcode is generated for the link, because the amount of data to be encoded much less;

Disadvantages include:

  • must be a server for data storage;
  • the device must have an ability to access the Internet.

This scheme can be seen in Figure 1.


common schema

Figure 1

Reading information from barcodes

Getting background information from the barcode is carried out in several stages (Figure 2):

  1. image recognition and reading information in the barcode;
  2. analysis of the information about its location: if the barcode stored only a reference to the background data – then download the data;
  3. perform operations which are associated with a particular data type (e.g. for business cards – it is entering the contact information in your address book).

common schema

Figure 2

Further transmission of received data to the various Internet services may be the final stage. If the link received, then this service may be a site that stores favorite links (for example, del.isio.us), if the event – the on-line calendar (eg, Google Calendar). In any case, it is possible to send the information on your e-mail and return to it later.

Mobile application

Now there are several operating systems (OS) for mobile devices. Accordingly, for each of them there is a set of tools (SDK – Software Developer Kit) for developing applications. But at the same time, many mobile OS also support applications written in Java Micro Edition (Java ME). If you look at the report of the company Canalys [http://www.canalys.com/pr/2008/r2008082.htm] for the second quarter of 2008, and reports of companies which are produce phones (for the percentage of phones which are supporting/not supporting Java ME), it is possible to say that at present more than 90 % of let out phones can run applications written on Java Micro Edition.

Because of the wide popularity of Java ME, application, which allows working with barcodes, was developed using it.

The program includes the following components:

  • module of getting barcode images (from camera or from a file);
  • barcode recognition module;
  • module of encoded information recognition;
  • module of working with Internet services;
  • module of interaction with address book and organizer devices.

Getting an image

Application allows getting barcode image in two ways:

  • from mobile camera phone (JSR-135 and JSR-234);
  • from file (FileConnection API from JSR-75).

Mobile Media API (JSR-135) – additional API for J2ME devices based on CLDS, supporting recording and playback of audio and video, as well as capture images with the built-in camera and the generation of tone.

Advanced Multimedia Supplements API (JSR-234) – is a further development of JSR-135. It is intended to enhance the multimedia possibilities of Java ME.

PDA Optional Packages (JSR-75) – includes two packages: Personal Information Management (PIM) and the FileConnection API. The first package allows working with files stored on the device. By means of the second package, it is possible to work with address book, device calendar.

With above-mentioned JSR getting an image is flows. However, at this process it was necessary to consider some features:

  1. even if it is declared that the device supports JSR-135 or JSR-234, it may occur that the given specifications are not completely implemented and, for example, work with the camera is not possible;
  2. image resolution can be less, than the real possibilities of the camera;

Therefore, if the device does not support JSR-135, JSR-234 or the image quality is not enough for recognition of barcode, the user has the opportunity to take pictures, using standard resources of phone, and then open them.

It is necessary to notice that mobile phones are used actively and in time there is a dust occurs on the built-in camera lens. Of course, quality of images made by such camera is bad, and the percentage of successful recognition of barcodes reduces.

Barcode recognition

To find and recognize the image ZXing library is used. It is free and comes with initial codes.

ZXing can recognize a large number of barcodes: UPC-A and UPC-E; EAN-8 and EAN-13; Code 39; Code 128; QR Code; Data Matrix (‘alpha’ quality); ITF.

The developed module, which allows recognizing barcode PDF417, has extended this list (only byte packing).

Data processing

As it was mentioned above – the user can encode any data in the barcode. Further possible operations depend on their type.

Obviously, the more opportunities the user will be given to work with each type of received information, the easier it will be working with this application. Therefore, support of popular Internet tools has been included in the program (Google Contacts, Google Calendar, a site on-line bookmarks delicious.com and information sending on e-mail) and phone standard applications (address book and calendar). The further functional extension is possible.

Table 1 provides a list of data types and acceptable operations over them, which are supported by the mobile application.

Data type Actions
Phone number - makes a dialed call on given number
SMS - the built-in phone SMS editor opens with pre-entered phone number and message (if it was specified)
Link to website - link opens in phone web-browser
- link adds in tools of bookmarks delicious.com
E-mail - run embedded applications on the phone to work with mail
Location - Google Maps opens in a phone web-browser with specified coordinates
Number ISBN - display search results in Google Books
Contact information - adding a contact in phone address book
- adding a contact to Google Contacts
Event - adding the event data in a built-in calendar
- adding events in Google Calendar

Also any type of information can be sent to e-mail.

It is necessary to mention that working with Internet services is carried out not directly, but through a separate application on the server (see Figures 3,4). Software for mobile devices works with it on HTTP-protocol.


common schema
Figure 3.


common schema
Figure 4.

This way of working gives us a number of advantages:

  • high speed of development, as there is no need to create a library for working with web-services for Java ME (usually many services provide libraries for working with them on Java SE);
  • client (mobile application) is more compact;
  • changing, for example, the protocol, which works with any of services, it will be enough to update only the application on the server – installed programs on mobile devices will remain unchanged;
  • possibility to keep statistics usage of the application.

Testing

When testing, the following phone models were used:

  • Nokia N97, N78, E51, 5310, 6120с.
  • SonyErricson Z720i.

Conclusion

As a result, the developed mobile application gives the user more freedom. Now the received information does not stay on the phone, and easily passed on to various Internet resources, mailbox. Of course, the current list of features is small. But it is necessary to mark that this functionality is completely absent in similar products.

Do you like the article and want us to develop your project? Feel free to contact us here!

© Copyright 2001-2012 Enterra Inc - Software outsourcing and Offshore Software development company.
All rights reserved. All content is copyrighted.

All trademarks mentioned in this blog belong to their respective owners.
Entries (RSS) and Comments (RSS).