Using J2ME to create Field Force Applications Chris Clark, MobileHWY, LLC.

Slides:



Advertisements
Similar presentations
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
Advertisements

CC SQL Utilities.
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
1 Chapter 12 Working With Access 2000 on the Internet.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Developing Software for Wireless Devices
Wireless LAN Topology Visualiser Project Supervisor: Dr Arkady Zaslavsky Project Team Members: Jignesh Rambhia Robert Mark Bram Tejas Magia.
Developing J2ME Applications Mobile and Wireless Networks.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
Cosc 4730 Phone Programming in Java An Introduction.
Introduction To Form Builder
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
Detecting Changes  ItemStateListener interface – detect changes in internal state of an Item  new selection made in a ChoiceGroup  adjusted value of.
Bar|Scan ® Asset Inventory System The leader in asset and inventory management.
How to Get The Most Out of Outlook 2003 Michele Schwartzman Division of Customer Support Summer 2006.
J2ME and WAP Technologies CSCI – Independent Study Fall 2002 Presented by: Kashif Syed.
Using Microsoft Outlook: Basics. Objectives Guided Tour of Outlook –Identification –Views Basics –Contacts –Folders –Web Access Q&A.
Application for Internet Radio Directory 19/06/2012 Industrial Project (234313) Kickoff Meeting Supervisors : Oren Somekh, Nadav Golbandi Students : Moran.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
The Operating System. Operating Systems (F) What you need to know about –operating system as a program; –directory/folder.
Finding Nearby Wireless Hotspots CSE 403 LCA Presentation Team Members: Chris Scoville Tessa MacDuff Matt Mohebbi Aiman Erbad Khalil El Haitami.
An Introduction to the Java ME Project Jens A Andersson.
1 Outlook Lesson 1 Outlook Basics and Microsoft Office 2010 Introductory Pasewark & Pasewark.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 Using the KToolbar Rob Pooley
Sage CRM Developers Course
J2ME Messaging Khanh Le. Objective  The objective of wireless messaging is to extend the networking and I/O capabilities of J2ME applications to send.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Java Mobile Application sms,sim,mms and barcode application Presented by Ayedh(SIM and MMS) Asad(SMS and Barcode Application)
Your personal Display Section Presence notes Display Picture & ‘Indicator’ Contacts Activity Feeds Conversations Phone Options Your Location Your Presence.
Scoring Program Updates & XML upload to the NSRCA web site July 2013.
Move Pictures From Your Mobile Phone to Your PC.  You never know when a photo opportunity is going to arise, which is why having a camera phone can be.
Framework and application bytecode size CLDC MIDP kXML parser Utility classes Graphics Logic (MIDlet) Application Data (XML file)
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Unit 2—Using the Computer Lesson 14 and Electronic Communication.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 lcdui Rob Pooley
Streams Reading: 2 nd Ed: , rd Ed: 11.1, 19.1, 19.4
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 13 lcdui and OXO Rob Pooley
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 14 Various MIDlet examples Rob Pooley
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Mobile Photo James Anderson, Dustin Duran, Trevor Hamilton, Ahror Rahmedov, Vivek Rajkumar, Matthew Renzelmann.
Microsoft Office Outlook 2013 Microsoft Office Outlook 2013 Courseware # 3252 Lesson 6: Organizing Information.
Microsoft Office Illustrated Introductory, Second Edition Started with Outlook 2003 Getting.
Database Handling, Sessions, and AJAX. Post Back ASP.NET Functionality The IsPostBack method in ASP.NET is similar to the BlackBerry.refresh method –IsPostBack.
Microsoft Access 2013 ®® Tutorial 10 Automating Tasks with Macros.
Exceptions Chapter 16 This chapter explains: What as exception is Why they are useful Java exception facilities.
FriendFinder Location-aware social networking on mobile phones.
FriendFinder Location-aware social networking on mobile phones.
How Your Customers Will Pay Online & by Phone
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
1 Introduction to J2ME Outline MIDP Building J2ME Apps- Tool J2ME Wireless Toolkit Demo MIDlet Programming -- MIDlet Transition States -- Midlet Skeleton.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
/16 Final Project Report By Facializer Team Final Project Report Eagle, Leo, Bessie, Five, Evan Dan, Kyle, Ben, Caleb.
START Application Spencer Johnson Jonathan Barella Cohner Marker.
Accelerometer based motion gestures for mobile devices Presented by – Neel Parikh Advisor Committee members Dr. Chris Pollett Dr. Robert Chun Dr. Mark.
 This work confers an application which makes possible to use a Bluetooth enabled mobile phone to remote control home appliances such electric fan, LEDs.
Lawson Mid-America User Group Spring 2016 Meeting.
Windows Vista Configuration MCTS : Internet Explorer 7.0.
CSE403: MIDlets and Ant1 MIDlets and Ant April 3, 2003 Shane Cantrell Zach Crisman.
Software Overview How to… Review Video and Data  Review the Journal Review the Journal  Simple Search Simple Search  Advanced Search Advanced Search.
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
ASP.NET Programming with C# and SQL Server First Edition
Java N Amanquah.
The intended use and features of Room Four Database
Presentation transcript:

Using J2ME to create Field Force Applications Chris Clark, MobileHWY, LLC

THE BUSINESS

The Mobility Business Building wireless applications that people can use everyday to get their job done. - Using cheap or existing hardware. $200 or less - Providing access to legacy data in a mobile environment - Using the Internet to get data to and from the mobile devices. $50/mth or less. - Leveraging GPS and Bluetooth to make the devices more capable.

What do customers want? Legacy Integration – Integrating with backend systems to make data available to mobile applications. GPS –Tracking of people, places and things using GPS coordinates. Credit Card Processing – Creating mobile POS. Printing – Bluetooth printing capability for receipts. Broadcast Messaging – Sending broadcast messages to mobile devices. Bluetooth Camera – To take pictures Bluetooth Compass – To not only determine location but direction you are facing.

Mobile Building Blocks Legacy Integration - Database access: SQL Server, Oracle, mySQL, Btrieve, Foxpro, ASCII Flat file - Mainframe screen scraping: Navigating 3270 screens. - Web screen scraping: Automation of web sites. - TCP Socket communication to host process. - VoiceXML: To automate Interactive Voice Response systems.

Mobile Building Blocks GPS – Global Positioning System - Location tracking: Reading GPS coordinates from mobile device. - Driving Directions – Get directions from where you are to where you need to go. - Route Navigation – Use GPS updates from the device to determine if route is being followed. Also can track speed and heading. - Dynamic mapping of field force – plot all data points for last known location of devices. - Proximity searching – search for locations near your current position. i.e. Location Based Services (LBS)

Mobile Building Blocks Credit Card Processing Using Bluetooth a mobile device can attach to a credit card swipe reader. All credit cards conform to the same specification for storing credit card information on Track 1. %/1/B ^ / ^ CRLF If you can read one, you can read them all.

Mobile Building Blocks Printing Customers want to print a variety of information. Printing on a mobile device involves using serial IO to connect to the printer. Then sending printer Esc codes to the printer to format the information for display. There are 2 flavors of serial printing. - Bluetooth printing (uses Bluetooth serial profile) - Tethered serial cable printing

Mobile Building Blocks Broadcast Messaging Customers have a high demand for being able to send out broadcast messages to their field force. Broadcast messaging uses a queuing server which contacts each device seperately and confirms delivery of the message. Primarly socket communications to the device’s IP address from a centralized server.

THE TECHNOLOGY

Mobile Development RULE #1 Using the device simulator is no indication of how the application is going to run on the device. RULE #2 Development tools are not all the same. RULE #3 You are breaking new ground. There will be issues that will require trial and failure

Several Things to Consider BUILD - Always build for optimal performance. It’s not a PC. - There will be code differences needed sometimes for different devices. Some java will not pass bytecode verification on the device. TEST - Know your carrier requirements for testing. - Make sure you test on the device. DEPLOY - Find out early how you get your application on the device

Getting Some Build Tools Sun Microsystems – Wireless Toolkit Blackberry Java Development Environment Motorola iDen developer EclipseME – J2ME plugin for Eclipse

It all starts with the MIDLET public class CreditCardDemo extends MIDlet { public Display display; /** * Signals the MIDlet to start and enter the Active state. */ protected void startApp() { display = Display.getDisplay(this); scrnCreditCard CreditCardForm = new scrnCreditCard(this); CreditCardForm.Show(); } /** * Signals the MIDlet to terminate and enter the Destroyed state. */ protected void destroyApp(boolean unconditional) { notifyDestroyed(); } /** * Signals the MIDlet to stop and enter the Paused state. */ protected void pauseApp() { /* Do Nothing */ } public void Show(Displayable d) { this.display.setCurrent(d); }

Understanding startApp() Applications will suspend sometimes because of incoming phone calls. startApp() will be called again when this happens, so make sure you restore to the proper screen. Don’t assume that every time startApp is called you should login. Normally, I keep a public variable around called display as part of the midlet class. I initialize display to a value when the application first starts. I check the value and restore to the proper state. Here is a modified startApp() protected void startApp() { if(display != null) { /* Do nothing, will restore the screen they were on */ } else { display = Display.getDisplay(this); scrnCreditCard CreditCardForm = new scrnCreditCard(this); CreditCardForm.Show(); }

Creating your screens Creating screens are pretty straight forward. You need a reference to the MIDlet’s display object. Display display = Display.getDisplay(MIDlet m); With this display object you can change the screen by calling setCurrent. display.setCurrent(Displayable display);

Creating your screens There are 2 Displayable objects Screen : Displayable Screen is what you should think about when you are designing form based applications. This is primarily what we use. Canvas : Displayable Canvas is more centered toward games or custom controls. With Canvas also comes the ability to read the devices keyboard through events. This is really designed more toward games.

Creating your screens There are 4 types of objects you can use with setCurrent(); Form : Screen You insert Items onto the Form using Form.append or Form.insert Alert : Screen Alerts are similar to VB message box. They provide quick notifications as to what the application is doing. As with message box there are different types of Alerts (Alarm, Confirmation, Error, Info, Warning). TextBox : Screen A textbox is similar to HTML. This is for multi-line text entry. List : Screen A list is for displaying a list of choices. Lists can contain images.

Creating your screens There are several Items you can add to your Form. ChoiceGroup : Item Similar to List except in a Form. DateField : Item For presenting calendar (date and time) information. Gauge : Item Bar graph ImageItem : Item Add image StringItem : Item Add string TextField : Item Input text box with optional formatting constraints.

Processing Commands Your class needs to support the CommandListener interface public class scrnCreditCard implements CommandListener { You need to define the command private static Command CMD_EXIT = new Command("EXIT", Command.ITEM, 1); You need to implement the CommandListener interface public void commandAction(Command c, Displayable d) { if (c == CMD_EXIT) { app.destroyApp(true); } If you intend to access your Form’s Items within the commandAction, you need to define your Item at the class level. private StringItem progressLabel;

Data Storage javax.microedition.rms.RecordStore – Record Management System J2ME provides a really basic storage capability for storing strings called a RecordStore. A database is a stretch. Think of being able to store strings in a file and retrieve them based on a record ID. In practical use, we create ENTITY CLASSES that are capable of going to and from strings. We create a class with all it’s properties and provide: - parse() method for retrieving the state of the object from a string. - toString() method for storing the state of the object to a string. Using this capability, we are able to effectively retrieve objects from the RecordStore and return them to their state.

Data Storage SELECT public void getRecord( int recordId ); INSERT public int RecordStore.addRecord( byte[ ] data, int offset, int numBytes ) ; UPDATE public void setRecord( int recordId, byte[ ] newData, int offset, int numBytes ); DELETE public void deleteRecord( int recordId );

HTTP StringBuffer text = new StringBuffer(); HttpConnection c = (HttpConnection) Connector.open(getUrl, Connector.READ_WRITE, true); c.setRequestMethod(HttpConnection.GET); int rc = c.getResponseCode(); if (rc == HttpConnection.HTTP_OK) { InputStream is = c.openDataInputStream(); int ch; while((ch = is.read()) != -1) { text.append((char) ch); } } else { throw new IOException("HTTP response code: " + rc); } String response = text.toString();

Entity Classes We heavily use ENTITY CLASSES for the data operations in the mobile device. After retrieving data through some method of HTTP. Create a new instance of your ENTITY CLASS Set the properties of the ENTITY CLASS from the data you have retrieved through HTTP. A simple method maybe to parse through some XML. After you have the state of your ENTITY CLASS. Convert this state to a string by calling the toString() method. Store this string in your RecordStore using RecordStore.add(…);

GPS GPS support is going to be dependant on device. JSR129 or MAYBE NOT JSR129 EXAMPLE try { // Lots of Criteria options are available per spec, few supported Criteria myCriteria = new Criteria(); LocationProvider myLocProv = LocationProvider.getInstance(myCriteria); // If no result could be retrieved, a LocationException is thrown. Location myLocation = myLocProv.getLocation(-1); // returns a QualifiedCoordinates object which also has accuracy information // inherits from Coordinates object QualifiedCoordinates myCoordinates = myLocation.getQualifiedCoordinates(); // get the Coordinates from the QualifiedCoordinates double myLat = myCoordinates.getLatitude(); double myLng = myCoordinates.getLongitude(); } catch (LocationException locex) { // Could not get a fix }

GPS Mapping Once you have the coordinates of the device. Most of the GPS features are implemented using other services. A dynamic mapping example. Tracking the device may require you to send the coordinates to a centralized server and time and date stamp them into a database. A web based system may retrieve the coordinates and display them to the user on a map. Lot of technologies may be in play here with the mobile device being the most simple of the technologies employed. Mapping Strategies Automation of MapPoint to create custom.NET Web services Using Microsoft MapPoint Web Services Using MapQuest Web Services

J2ME Connector Whether you are doing serial printing using a tethered cable to the device or Bluetooth. The process is pretty much the same. J2ME offers a Connector architecture for communications. Serial communications is just about the same as HTTP except for the ConnectionString. If you know how to work with Streams in J2ME you can communicate to most anything. In serial communication, you are primarily dealing with COM0. String connstring = "comm:0;baudrate=19200;parity=n;databits=8;stopbits=1;flowcontrol=s/s"; Bluetooth varies and most connection strings appear to be proprietary based on the hardware. In some cases the connection string is even abstracted through classes as you will see in the next example.

J2ME Connector String connstring = "comm:0;baudrate=19200;parity=n;databits=8;stopbits=1;flowcontrol= s/s";

Bluetooth Serial Printing BluetoothSerialPortInfo[] info = BluetoothSerialPort.getSerialPortInfo(); // Get first Bluetooth Serial Device registered with this mobile device String bluetoothConnectionString = info[0].toString(); StreamConnection sc = (StreamConnection) Connector.open(bluetoothConnectionString, Connector.READ_WRITE); DataOutputStream outstream = sc.openDataOutputStream(); outstream.write(this.data.getBytes()); outstream.flush(); outstream.close(); sc.close();