<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
    <title type="html">Mobility Tech Tips</title>
    <subtitle type="html">Create, test, and deploy applications on Java platforms for mobile and embedded devices</subtitle>
    <id>http://blogs.sun.com/mobility_techtips/feed/entries/atom</id>
            
        <link rel="alternate" type="text/html" href="http://blogs.sun.com/mobility_techtips/" />
        <updated>2009-11-10T13:03:54-08:00</updated>
    <generator uri="http://roller.apache.org" version="4.0.1.1 (BSC) (20091027075624)">Apache Roller</generator>
        <link rel="self" href="http://feeds.feedburner.com/mobilitytechtips" type="application/atom+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/powerful_logging_in_java_me</id>
        <title type="html">Powerful Logging in Java ME</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/xbKu3-wP5YI/powerful_logging_in_java_me" />
        <published>2009-11-02T13:30:28-08:00</published>
        <updated>2009-11-02T13:30:28-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="logging" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;Have you ever wanted to log from your MIDlet? You may have considered doing your own logging facility. Why not use an existing solution: The Microlog open-source logging library. It is based on the well known Log4j API or logging library, but has been created from the ground up with Java ME limitations in mind.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;&lt;p&gt;&lt;i&gt;By Johan Karlsson&lt;/i&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;You have just developed your new cool MIDlet, the one that is going to rule the world. It runs like a well oiled machine on the emulator. But when you download and install it on your target device, the MIDlet seems to take ages to start up. Finally, you see the splash screen. Oh no! The MIDlet crashes and you get an error pop-up saying "Application Error," and the MIDlet shuts down. What happened? This is not the way you pictured it. Is there something that shows what really happened behind the scenes?&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Have you been in a situation like this? Have you ever wanted to log from your MIDlet? Read on, and I will teach how to add powerful logging to your MIDlets.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;You may have considered doing your own logging facility. But why not use an existing solution: The Microlog open-source logging library. It is based on the well known Log4j API or logging library, but has been created from the ground up with Java ME limitations in mind.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/javame/javame-logging/index.html"&gt;Read the full article.&lt;/a&gt;&lt;/p&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/xbKu3-wP5YI" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/powerful_logging_in_java_me</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/simple_strategy_for_logging_and</id>
        <title type="html">Simple Strategy for Logging and Monitoring of MIDlets</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/w-cvQdTlRC8/simple_strategy_for_logging_and" />
        <published>2009-09-28T11:02:43-07:00</published>
        <updated>2009-09-28T11:02:43-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="midlets" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">&lt;p&gt;On-device debugging isn't useful when your MIDlet is running on a client's phone. This tech tip presents one approach to developers who want a fast and simple way to debug their apps remotely in real environments.
&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;By &lt;a href="http://java.sun.com/features/authors.html#goyal"&gt;Vikram Goyal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Logging and monitoring your MIDlet in development is easy. Just print some lines on the console around critical events, and you know what is happening within your MIDlet. Integrated development environments (IDEs) such as the NetBeans IDE make this even easier by allowing you to do on-device debugging. But this is of no use to you when your MIDlet is actually being run on a client's phone.

&lt;p&gt;How do you monitor your killer MIDlet? Can you receive notification if something critical happens? Can you get an SMS to attend to notifications? Of course, you can. Several APIs make this possible, and this tech tip will show you how to combine them into a single interface.&lt;/p&gt;

&lt;h2&gt;Simulate Logging Events&lt;/h2&gt;

&lt;p&gt;To simulate the various events in an actual MIDlet, I have created a simple MIDlet with a random-event generator. The random-event generator simulates activity within the MIDlet and does nothing for normal events. Because informational events  in any MIDlet are more likely to occur than warning, error, or critical events, this random MIDlet takes a sliding-scale approach to generating these events. The scale is implemented in the following code:

&lt;pre&gt;
    // now try and simulate an event within this application
    int rand = random.nextInt(19);

    if (rand &amp;gt; 8) { // no event that needs logging if random no &amp;lt; 9
      if (rand &amp;lt;= 13) { // info
        form.append(midlet.getInfo());
        midlet.doInfoLog("This is an information message.");
      } else if (rand &amp;lt;= 15) { // warn
        form.append(midlet.getWarn());
        midlet.doWarnLog("This is a warning!");
      } else if (rand &amp;lt;= 17) { // error
        form.append(midlet.getError());
        midlet.doErrorLog("Oh, no, an error occurred!");
      } else { // critical
        form.append(midlet.getCritical());
        midlet.doCriticalLog("The sky is falling!");
      }
  }
&lt;/pre&gt;

&lt;p&gt;When you run the MIDlet and start the activity, it will cycle through a clock going from 1 to 15. This is a timer that shows the user that some activity is happening within the MIDlet. During each activity cycle, a random number is generated. As shown in the previous code, if the random number is within the prescribed ranges, it triggers the corresponding logging event. The simple events, and the ones most likely to occur, are the informational messages. The most dire events are the ones that are marked as critical, and they occur only if the random number is exactly equal to 18.&lt;/p&gt;

&lt;h3&gt;What to Log Where&lt;/h3&gt;

&lt;p&gt;I have made the assumption that informational messages are to be recorded only, perhaps, as a way for a technical team to audit if they can get their hands on the actual device if something more critical happens. Similarly, I have assumed that warning messages are to be logged to a nearby Bluetooth device, error messages to an Internet server, and critical messages to be sent by way of SMS.
&lt;/p&gt;

&lt;h3&gt;Create a Logging Interface&lt;/h3&gt;

&lt;p&gt;To keep things simple, the MIDlet makes decisions on the severity of the logging messages and creates loggers based on that assumption (described in the previous section). The following code shows how these decisions are implemented:

&lt;pre&gt;
    private void createLoggers() {
      infoLog = new RMSLogger();
      warnLog = new BluetoothLogger();
      errorLog = new InternetLogger();
      criticalLog = new SMSLogger();
  }
&lt;/pre&gt;

&lt;p&gt;Each logger is an implementation of the simple &lt;code&gt;Logger&lt;/code&gt; interface. This interface is shown in the following code:


&lt;pre&gt;
    public interface Logger {

      public void doLog(String msg);
    }
&lt;/pre&gt;

&lt;p&gt;With a single method called &lt;code&gt;doLog&lt;/code&gt;, the interface defines a minimum contract for the implementations to follow. The actual implementations must then figure out how they will make the logging calls.&lt;/p&gt;

&lt;h3&gt;Create the Logging Implementations&lt;/h3&gt;

&lt;p&gt;Now, it is a simple method to figure out what the actual implementations will do. For example, the following code shows what the &lt;code&gt;RMSLogger&lt;/code&gt; will do:


&lt;pre&gt;
    package logger.impl;

    import javax.microedition.rms.RecordStore;
    import logger.Logger;

    public class RMSLogger implements Logger {

      private RecordStore rs;

      public RMSLogger() {
        try {
          rs = RecordStore.openRecordStore("Log_Store", true);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

      public void doLog(String msg) {
        byte[] rec = msg.getBytes();
        try {
          rs.addRecord(rec, 0, rec.length);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
&lt;/pre&gt;

&lt;p&gt;As you can see, the constructor does the background work of creating or opening the record store. The &lt;code&gt;doLog()&lt;/code&gt; method then does the heavy lifting, by writing the message to the record store.

&lt;p&gt;Similarly, here is the &lt;code&gt;InternetLogger&lt;/code&gt; code:

&lt;pre&gt;
    package logger.impl;

    import java.io.IOException;
    import java.io.OutputStream;
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    import logger.Logger;

    public class InternetLogger implements Logger {

      // set your destination URL here
      private String destURL = "";

      private HttpConnection conn;

      public InternetLogger() {

        try {
          conn = (HttpConnection) Connector.open(destURL);
          conn.setRequestMethod(HttpConnection.POST);
          conn.setRequestProperty(
            "Content-Type", "application/x-www-form-urlencoded");
        } catch (Exception e) {
          e.printStackTrace();
        }

      }

      public void doLog(String msg) {
        try {
          // The destination URL must be set before doLog is called.

          if(conn == null) {
            System.err.println("DEST URL is not valid.");
            return;
          }
          conn.setRequestProperty("Content-length", "" +
            ("msg=" + msg).getBytes().length);

          OutputStream os = conn.openOutputStream();
          os.write(("msg=" + msg).getBytes());
          os.flush();

        } catch (IOException ex) {
          ex.printStackTrace();
        }
      }
    }
&lt;/pre&gt;

&lt;p&gt;The code here is just a placeholder, and you will need to fill in the destination URL where you want the message to be posted, along with some sort of identification of the sender of the message.

&lt;p&gt;&lt;code&gt;BluetoothLogger&lt;/code&gt; and &lt;code&gt;SMSLogger&lt;/code&gt; follow similar patterns, and the &lt;a href="http://blogs.sun.com/mobility_techtips/resource/LoggingDebuggingMIDlet.zip" target="_blank"&gt;source code&lt;/a&gt; contains the implementations for these. 
&lt;/p&gt;

&lt;h3&gt;Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://blogs.sun.com/mobility_techtips/resource/LoggingDebuggingMIDlet.zip" target="_blank"&gt;Source code&lt;/a&gt; as a NetBeans IDE project&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developers.sun.com/mobility/midp/articles/guiapis/" target="_blank"&gt;Java ME GUI APIs at a Glance&lt;/a&gt;
&lt;li&gt;&lt;a href="http://developers.sun.com/mobility/midp/articles/wtoolkit/" target="_blank"&gt;Wireless Development Tutorial, Part I&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developers.sun.com/mobility/midp/articles/tutorial2/" target="_blank"&gt;Wireless Development Tutorial, Part II&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/w-cvQdTlRC8" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/simple_strategy_for_logging_and</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/code_destroyapp_code_is_your</id>
        <title type="html">destroyApp() Is Your Friend</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/O2Ss-KiSbUc/code_destroyapp_code_is_your" />
        <published>2009-09-11T14:41:31-07:00</published>
        <updated>2009-09-11T14:41:31-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">Concurrency and data safety are complex subjects. This tech tip addresses specific issues around handling individual record-entry safety and third-party libraries.</summary>
        <content type="html">&lt;p&gt;By &lt;a href="http://java.sun.com/features/authors.html#goyal" target="_blank"&gt;Vikram Goyal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This tip is in response to a recent discussion on the Sun forums about the &lt;a href="http://forums.sun.com/thread.jspa?messageID=10793820"&gt;thread-safety of &lt;code&gt;RecordStore&lt;/code&gt; operations&lt;/a&gt;. Although the discussion goes in several different directions, the core question remains: How do you protect yourself from unsafe operations of third-party libraries?

&lt;p&gt;The answer is not simple, but this tech tip will try to answer the &lt;a href="http://forums.sun.com/thread.jspa?messageID=10791533#10791533"&gt;specific example&lt;/a&gt; raised at the start of this discussion. Perhaps that will help provide general directions for handling such things in the real world.&lt;/p&gt;

&lt;h3&gt;&lt;code&gt;RecordStore&lt;/code&gt; Safety&lt;/h3&gt;

&lt;p&gt;The problem boils down to individual record entry safety. The record entry method itself is atomic, &lt;code&gt;recordStore.addRecord()&lt;/code&gt;, and therefore guaranteed to be thread-safe. However, as pointed out in the &lt;a href="http://forums.sun.com/thread.jspa?messageID=10793820"&gt;forums discussion&lt;/a&gt;, if consistency is measured in terms of two records being written to the record store, and if only one is entered and the second entry is interrupted because the application management software (AMS) has called &lt;code&gt;destroyApp()&lt;/code&gt; between the two calls, have you lost a way to manage your data? Is the data now inconsistent?

&lt;p&gt;Of course not.

&lt;p&gt;This is where the real reason for the &lt;code&gt;destroyApp()&lt;/code&gt; method comes into the picture, even if it is called by third-party software.

&lt;p&gt;In the following code, I present the &lt;code&gt;destroyApp()&lt;/code&gt; method that would handle this scenario consistently.

&lt;pre&gt;
  public void destroyApp(boolean unconditional)
    throws MIDletStateChangeException {

    if(!unconditional) {
      if(!recordsWritten) { // Records have not been written yet -- wait!
        throw new MIDletStateChangeException();
      } else { // Records written -- MIDlet can be destroyed!
      }
    } else { // must destroy
      if(!recordsWritten) {
        // Roll back the record that was written.
        if(storage != null) { // Was the store ever opened?
          try {
            storage.deleteRecord(recordId1);
          } catch (Exception ex) {
            ex.printStackTrace();
          }
        }
      }
    }
  }
&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;destroyApp()&lt;/code&gt; method gives you a way to complete unfinished items before it actually closes the MIDlet. The AMS may want to close the MIDlet &lt;em&gt;unconditionally&lt;/em&gt;, in which case, you have no choice but to close the MIDlet. But if the closing is not unconditional, and if in the middle of the writing process, you can throw the &lt;code&gt;MIDletStateChangeException&lt;/code&gt; to finish the writing process.

&lt;p&gt;Because the data is considered to be consistent only if all of it is written (in this case, two record items), you use the flag of &lt;code&gt;recordsWritten&lt;/code&gt; to indicate this. Then you use this flag to monitor the state of the data.

&lt;p&gt;If this flag is set as &lt;code&gt;false&lt;/code&gt;, you have not finished the writing process, so you must roll back any data that has been written. It is possible that the &lt;code&gt;destroyApp()&lt;/code&gt; method may be called before either of the records has been written. This is fair enough, and trying to delete the first record will raise an exception, which is silently ignored.

&lt;p&gt;The process of writing -- and deleting -- data is itself atomic, so you can be fairly confident that data is not corrupted in between the writing processes. To further insulate from such corruption, you can synchronize on the storage object while writing or deleting.&lt;/p&gt;

&lt;p&gt;I hope that this simple example has given you an idea on how to handle the effects of third-party libraries better. Concurrency and data safety are complex subjects, and the developer should understand the problem domain in detail before attempting specific solutions.&lt;/p&gt;

&lt;h3&gt;Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://java.sun.com/docs/books/tutorial/essential/concurrency/" target="_blank"&gt;The Java Tutorial's concurrency track&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.javaconcurrencyinpractice.com/" target="_blank"&gt;Java Concurrency in Practice&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/Interviews/goetz_qa.html" target="_blank"&gt;Writing Better Code: A Conversation With Sun Microsystems Technology Evangelist Brian Goetz&lt;/a&gt;&lt;/li&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/O2Ss-KiSbUc" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/code_destroyapp_code_is_your</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/more_reasons_to_use_javafx</id>
        <title type="html">More Reasons to Use JavaFX for Your Next Mobile Application</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/aQFdGGhkZwM/more_reasons_to_use_javafx" />
        <published>2009-08-31T22:11:23-07:00</published>
        <updated>2009-08-31T22:11:23-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="linux" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">&lt;p&gt;Bruce Hopkins briefly answers the questions that were submitted in the Comments section of his article &lt;a href="http://java.sun.com/developer/technicalArticles/javame/javafxmobile-javame/"&gt;Three Reasons Why Your Next Java ME Mobile Application Should Include JavaFX Mobile&lt;/a (on JavaFX 1.1), and to simultaneously highlight some of the capabilities of JavaFX 1.2. &lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;By &lt;a href="http://java.sun.com/features/authors.html#hopkins"&gt;Bruce Hopkins&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My article &lt;a href="http://java.sun.com/developer/technicalArticles/javame/javafxmobile-javame/"&gt;Three Reasons Why Your Next Java ME Mobile Application Should Include JavaFX Mobile&lt;/a&gt; introduced the overall Java FX architecture and, specifically, the Java FX Mobile 1.1 APIs. Well, the JavaFX 1.2 APIs have been released since then, with tons of new features that were requested by you, the developer community.&lt;/a&gt; 

&lt;p&gt;The purpose of this tech tip is to briefly answer the questions that were submitted in the Comments section of the original article (on JavaFX 1.1), and to simultaneously point to some of the capabilities of JavaFX 1.2. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Question 1: When will development tools for JavaFX for Linux be available?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Answer:&lt;/b&gt; The newly released &lt;a href="http://java.sun.com/javafx/downloads/"&gt;JavaFX 1.2 SDK&lt;/a&gt; is now available for the following four platforms:
&lt;ul&gt;
&lt;li&gt; Windows&lt;/li&gt;
&lt;li&gt; Mac OS X&lt;/li&gt;
&lt;li&gt; Linux&lt;/li&gt;
&lt;li&gt; Open Solaris&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Question 2: How can I load my JavaFX applications on a mobile device?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Answer:&lt;/b&gt;  Applications created with the JavaFX 1.1 SDK were not supported on mobile devices for deployments, so it was not possible to get your JavaFX 1.1 Mobile application running on a real handset (unless you did some real hacking). However, the &lt;a href="http://java.sun.com/javafx/downloads/"&gt;JavaFX 1.2 SDK&lt;/a&gt; is capable of creating mobile applications that can be deployed to Windows Mobile 6.0 and 6.1 devices. Terrence Barr has created a &lt;a href="http://mediacast.sun.com/users/terrencebarr123/media/FXMobileEA-screencast"&gt;screencast&lt;/a&gt; with detailed instructions that show developers how to get started.

&lt;p&gt;&lt;b&gt;Question 3: How can I learn about all the new features in JavaFX 1.2?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Answer:&lt;/b&gt; You can learn about all the new features in JavaFX 1.2 in an &lt;a href="http://javafx.com/docs/articles/javafx1-2.jsp"&gt;Features and Enhancements&lt;/a&gt; article written by Inyoung Cho. Additionally, it’s always good to have the &lt;a href="http://java.sun.com/javafx/1.2/docs/api/"&gt;JavaFX APIs&lt;/a&gt; handy whenever you learn how to use a particular class.

&lt;p&gt;&lt;b&gt;Final Thoughts&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The JavaFX 1.2 APIs include many new features that allow desktop, mobile, and web developers to create compelling, dynamic, and feature-rich applications. &lt;a href="http://java.sun.com/javafx/1.2/docs/api/"&gt;Check them out.&lt;/a&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/aQFdGGhkZwM" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/more_reasons_to_use_javafx</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/faster_data_transfer_with_bluetooth</id>
        <title type="html">Faster Data Transfer With Bluetooth and Contactless Communication</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/wpvCFJ-pxAk/faster_data_transfer_with_bluetooth" />
        <published>2009-07-27T16:22:03-07:00</published>
        <updated>2009-07-27T16:22:03-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="me" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <category term="nfc" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">Learn how Bluetooth applications can bypass the device discovery and service searching by using Near-Field Communication (NFC) technology and JSR 257 (Contactless Communication API).</summary>
        <content type="html">&lt;p&gt;NFC is a radio-communication standard that enables wireless data transfer between two devices at a very short distance -- less than 10 centimeters. NFC devices include a certain class of radio-frequency identification (RFID) tags and contactless smart cards. NFC devices operate within the 13.56 MHz frequency range, and they support extremely low data rates -- a maximum of 0.42 Mb per second.&lt;/p&gt;

&lt;p&gt;Compared to Bluetooth and Wi-Fi, NFC technology operates at drastically reduced transfer rates and only within a very small proximity. If that's the case, why use NFC technology? Three reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;b&gt;Setup time.&lt;/b&gt; NFC devices communicate instantly -- in less than 100 milliseconds -- when placed within range.&lt;/li&gt;
&lt;li&gt; &lt;b&gt;Power consumption.&lt;/b&gt; NFC tags and cards do not consume power, so their lifespan can be unlimited.&lt;/li&gt;
&lt;li&gt; &lt;b&gt;Cost.&lt;/b&gt; NFC tags and cards are inexpensive to manufacture compared to other wireless technologies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article shows you how to get Bluetooth applications to completely bypass the device-discovery and service-searching processes simply by using Near-Field Communication (NFC) technology and JSR 257: Contactless Communication API.&lt;/p&gt;

&lt;a href="http://java.sun.com/developer/technicalArticles/javame/nfc_bluetooth/"&gt;Read the full article&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/wpvCFJ-pxAk" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/faster_data_transfer_with_bluetooth</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/javafx_on_the_mac_os</id>
        <title type="html">JavaFX on the Mac OS: Security Warning</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/vacmB4xWrWk/javafx_on_the_mac_os" />
        <published>2009-07-27T10:00:34-07:00</published>
        <updated>2009-07-27T10:00:34-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;Have you been seeing a newly worded warning message appear when you access JavaFX.com  samples or documentation examples on your Mac? This tech tip explains how to turn off the message.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;Check out the &lt;a href="http://blogs.sun.com/javafx/entry/new_security_warning_for_mac"&gt;MAC applet blog entry&lt;/a&gt; regarding the new security warning on Macs. It's directed to Mac users who access javafx.com pages with embedded applets and who now see this warning:&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;img src="http://blogs.sun.com/mobility_techtips/resource/applet_unrestrictedaccess.png" alt="Access dialog box" /&gt; &lt;/p&gt; &lt;/p&gt;


&lt;p&gt;To prevent the message from appearing, check &lt;b&gt;&lt;code&gt;Allow all applets from &amp;quot;javafx.com&amp;quot; access&lt;/code&gt;&lt;/b&gt;.&lt;/p&gt;


&lt;p&gt;It happens because Apple has changed to a site/URL-based security model in one of its recent Java updates. In previous updates of Java for Mac OS X, unless the applet was cached a Trust dialog box appeared with different text and unrestricted access information in the fine print: &lt;i&gt;This applet was signed by "JavaFX Runtime," but Java cannot verify the authenticity of the signature's certificate. Click Trust to run this applet and allow it unrestricted access to your computer.&lt;/i&gt;&lt;/p&gt;


&lt;p&gt;For more technical information about Java for Mac OS X v10.5 Update 4, see the &lt;a href="http://support.apple.com/kb/HT3581"&gt;Apple support documentation&lt;/a&gt;.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/vacmB4xWrWk" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/javafx_on_the_mac_os</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/java_me_sdks_the_state</id>
        <title type="html">Java ME SDKs and Tools: The State of the Union</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/etI5GH_0Xjk/java_me_sdks_the_state" />
        <published>2009-07-08T10:46:43-07:00</published>
        <updated>2009-07-08T10:46:43-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="me" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">The Java ME platform is huge, robust, and versatile. This article provides a compatibility matrix of tools, SDKs, and APIs, including NetBeams, MOTODEV Studio, Nokia, Blackberry, Sony Ericsson, and LG.</summary>
        <content type="html">&lt;p&gt;This article demonstrates that Java ME developers have a wide array of choices -- in addition to the full-featured &lt;a href="http://java.sun.com/javame/downloads/sdk30.jsp"&gt;Java ME SDK&lt;/a&gt; (which replaces the well-known Wireless Toolkit) -- to create and test applications.

&lt;p&gt;The Sun Java ME SDK 3.0, considered the de facto standard SDK when it comes to mobile application development, integrates the very popular Java Wireless Toolkit for CLDC and the Java Toolkit for CDC as a single product. It lets developers create Java ME applications for the following JVM platforms:
&lt;ul&gt;
&lt;li&gt; CLDC/MIDP: The common JVM configuration for hundreds of millions of mobile phones&lt;/li&gt;
&lt;li&gt; CDC/FP/PBP/AGUI: The JVM configuration for high-end smart phones and other devices&lt;/li&gt;
&lt;li&gt; CDC/FP/PBP/BD-J: The JVM configuration for Blu-ray Disc players&lt;/li&gt;
&lt;/ul&gt; 

&lt;p&gt;In addition to the Sun Java ME SDK 3.0, this article include details on the following offerings and then summarizes them in a handy comparison table:
&lt;ul&gt;
&lt;li&gt; NetBeans 6.5 IDE&lt;/li&gt;
&lt;li&gt; MOTODEV Studio for Java ME&lt;/li&gt;
&lt;li&gt; Nokia S60, S40, and NFC SDKs&lt;/li&gt;
&lt;li&gt; BlackBerry JDE 4.7&lt;/li&gt;
&lt;li&gt; Sony Ericsson SDK 2.5 for Java ME&lt;/li&gt;
&lt;li&gt; LG SDK 1.2 for Java ME&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Java ME SDK Comparison Matrix table shows a list of all Java ME SDKs and tools that are evaluated in this article, with an entry for API support for each one. (&lt;b&gt;Note:&lt;/b&gt;  The NetBeans IDE supports multiple Java configurations, so its entries in this matrix apply to when it is configured with the Java ME SDK 3.0.)

&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/javame/stateoftheunion/"&gt;Read the full article&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/etI5GH_0Xjk" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/java_me_sdks_the_state</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/working_with_bluetooth_and_gps1</id>
        <title type="html">Working with Bluetooth and GPS: Follow-up</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/USvmg_f6epw/working_with_bluetooth_and_gps1" />
        <published>2009-06-10T15:21:01-07:00</published>
        <updated>2009-06-23T11:12:58-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="bluetooth" scheme="http://roller.apache.org/ns/tags/" />
        <category term="gps" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javax.microedition.bluetooth" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;The “Working with Bluetooth and GPS” series on the Bluetooth API (JSR-82) spawned a number of questions, which author Bruce Hopkins addresses in this follow-up tech tip.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;&lt;p&gt;&lt;i&gt;By &lt;a href="http://java.sun.com/features/authors.html#hopkins"&gt;Bruce Hopkins&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;After reading both &lt;a href="http://developers.sun.com/mobility/apis/articles/bluetooth_gps/part1/"&gt;Part 1&lt;/a&gt; and &lt;a href="http://developers.sun.com/mobility/apis/articles/bluetooth_gps/part2/"&gt;Part 2&lt;/a&gt; of the “Working with Bluetooth and GPS” series of articles, you were given a clear explanation of the example code that shows you how to do the following:&lt;/p&gt;


&lt;p&gt;&lt;ol&gt;&lt;br/&gt;
1. Use the JSR-82 Bluetooth API to access the data from a Bluetooth-enabled GPS receiver&lt;br/&gt;
2. Parse the data streams in NMEA format  and obtain the coordinates of your current location&lt;br/&gt;
3. Formulate an HTTP request to access an external mapping service&lt;br/&gt;
4. Use the JSR-172 XML Parsing and Web Services API to parse an XML result&lt;br/&gt;
5. Make a request in order to display a map image&lt;br/&gt;
&lt;/ol&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Therefore, the purpose of this tech tip is to provide answers to the questions that were submitted by the readers of both articles in the series.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Question 1:&lt;/b&gt; Hi Bruce, I have a problem when I start the Mpowerplayer tool with any MIDlet that uses Bluetooth and the JSR-82 API.  When the application tries to execute my MIDet, it immediately displays a &lt;code&gt;java.lang.NoClassDefFoundError: javax/bluetooth/DiscoveryListener&lt;/code&gt;. What could be the problem?&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Answer 1:&lt;/b&gt; The MPowerplayer made a change on how it handles JSR-82 libraries between releases #1127 and #1185. Unfortunately, it not explicitly stated in the documentation, but you need to make two simple changes in order to run MIDlets that require the JSR-82 API:&lt;br/&gt;
&lt;ol&gt;&lt;br/&gt;
1. Place any JSR-82 implementation in the &lt;code&gt;/mpp-sdk&lt;/code&gt; folder. I’ve tested with the following JSR-82 implementations: Avetana (requires a license) and BlueCove (free open-source alternative).&lt;br/&gt;
2. Rename that file to be called &lt;code&gt;bt.jar&lt;/code&gt;.&lt;br/&gt;
&lt;/ol&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;After you make those two changes, you will be able to run any application requires the JSR-82 APIs.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Question 2:&lt;/b&gt; Hi Bruce, this is a nice article. I would like to know how to get GPS data from a mobile phone that already has a GPS receiver built-in.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Answer 2:&lt;/b&gt; If your mobile phone is MSA-compliant and already has a GPS radio built-in, then you don’t need to use the JSR-82 API to connect to a remote GPS receiver. All you need to do is use the JSR-179 Location APIs in order to retrieve your location data from an embedded GPS receiver.  If you’d like to get started with the JSR-179 API, then Qusay Mahmoud has written a great article, &lt;a href="http://developers.sun.com/mobility/apis/articles/location/"&gt;Java ME and Location-Based Services&lt;/a&gt;, on that topic.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Question 3:&lt;/b&gt; I have a Bluetooth-enabled GPS receiver: the Holux Slim 236. I also have a Bluetooth-enabled computer.  Can I run this example with what I have?&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Answer 3:&lt;/b&gt; Yes, you should have no problem running the example code using the tools that you have. If you plan to use the current version of Mpowerplayer, then be sure to follow the instructions in the answer to Q1 first.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Question 4:&lt;/b&gt; Hi Bruce, thanks for creating this meaningful guide for developers. Your original article shows developers how to use the Avetana Bluetooth JSR-82 implementation with the Mpowerplayer SDK. The problem, however is that Aventana implementation only provides a free 14-day trial, and afterwards requires a license fee. Is there any way to configure the Mpowerplayer with the BlueCove JSR-82 implementation which is open source?&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Answer 4:&lt;/b&gt; Yes, please refer to the answer provided to Q1 listed above in order to find out how to use the BlueCove library with the MPowerplayer SDK.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Question 5:&lt;/b&gt; Hi, I am having problem with this example with WTK 2.5.2 and NetBeans IDE 6.1 which are both installed in my PC. When I run this application on my PC, I’m not able to get any data from the remote Bluetooth devices.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Answer 5:&lt;/b&gt; Actually, the whole point of Part 1 in the two-part series was to show developers how to debug and test their JSR-82 applications on their PCs using the Mpowerplayer. Neither the WTK, the NetBeans IDE, nor the Java ME SDK have the ability to leverage the Bluetooth hardware of your PC in order to discover or search for services on remote Bluetooth devices.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Question 6:&lt;/b&gt; I have a Bluetooth-enabled phone with a built-in GPS receiver. I want to send NMEA data from the phone to a Bluetooth-enabled PC. I have a desktop application (Streets &amp; Trips) that can consume GPS data.  Since my phone support GPS and Bluetooth, is there a Java ME application that will enable my mobile phone to do this? &lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Answer 6:&lt;/b&gt; I don’t know of any Java ME applications that do this, however this sounds like the basis for another article!&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;b&gt;Final Thoughts&lt;/b&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Thanks to all the readers who took the time to provide feedback to this article series! Your input, thoughts, questions, and ideas are always welcome and appreciated.&lt;/p&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/USvmg_f6epw" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/working_with_bluetooth_and_gps1</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/using_the_location_api_for</id>
        <title type="html">Using the Location API for Favorite Spots</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/mKa5-_hRlDQ/using_the_location_api_for" />
        <published>2009-04-22T18:11:04-07:00</published>
        <updated>2009-05-11T15:49:24-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="me" scheme="http://roller.apache.org/ns/tags/" />
        <category term="midlets" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">This tech tip shows you how to get started using the Location API (&lt;a href="http://jcp.org/en/jsr/detail?id=179"&gt;JSR 179&lt;/a&gt;), and how to build a small location-aware application that you can use to tag your favorite spots.</summary>
        <content type="html">&lt;p&gt;&lt;i&gt;By &lt;a href="http://java.sun.com/features/authors.html#goyal" target="_blank"&gt;Vikram Goyal&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;Developing location-aware applications seems like a lot of work, especially since getting started seems to be the hardest part. In this tech tip, I will show you how to get started using the Location API (&lt;a href="http://jcp.org/en/jsr/detail?id=179"&gt;JSR 179&lt;/a&gt;) to get over the initial hurdle, and build a small location-aware application that you can use to tag your favorite spots.&lt;/p&gt;

&lt;p&gt;I have tested and verified that the MIDlet works on a Nokia N95 device. When testing this on your device, make sure that it supports the Location API (JSR 179).&lt;/p&gt;

&lt;p&gt;There are three steps in this tech tip
&lt;ol&gt;
&lt;li&gt; &lt;a href="#1"&gt;Find and initialize a location provider&lt;/a&gt;&lt;/li&gt;
&lt;li&gt; &lt;a href="#2"&gt;Listen and act on location updates given by this provider&lt;/a&gt;&lt;/li&gt;
&lt;li&gt; &lt;a href="#3"&gt;Store and list favorite spots&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
The following paragraphs elaborate on these steps. It may help to have the entire &lt;a href="http://blogs.sun.com/mobility_techtips/resource/LocationTechTip.zip"&gt;source code&lt;/a&gt; of this MIDlet available for review while following the code snippets in these steps.&lt;/p&gt;

&lt;h2&gt;Step 1: Find and initialize a location provider&lt;/h2&gt;&lt;a name="1"&gt;&lt;/a&gt;

&lt;p&gt;The process of discovery of a suitable location provider is broken down into two further steps. First, you need to create a set of criteria for the location provider. Second, you need to create an instance of this provider using these criteria.&lt;/p&gt;

&lt;p&gt;The Location API provides two classes for these two steps: &lt;code&gt;Criteria&lt;/code&gt; and &lt;code&gt;LocationProvider&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To create a valid criteria, you create an instance of this class, set various parameters of the criteria. The code below, taken from the
source code, creates a criteria that is suitable for our purposes.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  // create a very basic criteria for the provider
  Criteria criteria = new Criteria();
  criteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
  criteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
  criteria.setPreferredResponseTime(Criteria.NO_REQUIREMENT);
  criteria.setCostAllowed(false);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As you can see, this is a very relaxed criteria. There are no specific requirements for horizontal or vertical accuracy or for response times. The only restriction
is that there should not be a cost involved in using the Location API (possibly linked to the network provider).&lt;/p&gt; 

&lt;p&gt;We should be allowed to proceed only if the Location API built into your device can provide a provider based on these criteria. We do so, by asking the &lt;code&gt;LocationProvider&lt;/code&gt; class for a provider using these criteria as the guiding set.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  // get the provider based on this criteria
  LocationProvider provider = LocationProvider.getInstance(criteria);

  // provider found
  if (provider != null) {
    provider.setLocationListener(this, -1, 0, 0);
  } else {
    display.setCurrent(
      new Alert("Error!",
      "Phone does not support Location Provider with the given criteria",
      null, AlertType.ERROR));
  }
&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;If a provider with the given criteria cannot be found, a message is given to the user, and the MIDlet cannot proceed. But if the device can provide a valid location provider, the MIDlet sets up a location listener to listen to all the updates given by the location provider. In this case, the listener is the MIDlet itself.&lt;/p&gt;

&lt;h2&gt;Step 2: Listen and act on location updates&lt;/h2&gt;&lt;a name="2"&gt;&lt;/a&gt;

&lt;p&gt;In the previous step, the location listener is set to the MIDlet itself. This means that the MIDlet must implement two methods provided by the
&lt;code&gt;LocationListener&lt;/code&gt; class. These two methods are &lt;code&gt;locationUpdated(LocationProvider lp, Location l)&lt;/code&gt; and
&lt;code&gt;providerStateChanged(LocationProvider lp, int newState)&lt;/code&gt;. The code below shows the implementation of the &lt;code&gt;locationUpdated&lt;/code&gt; method.&lt;/p&gt;

&lt;pre&gt;
&lt;code&gt;
  // if valid location is found, update the coords and status
  if(location != null &amp;&amp; location.isValid()) {
    QualifiedCoordinates coords = location.getQualifiedCoordinates();
    coordsDisplay.setText(
      truncate(coords.getLatitude()) + ", " +
      truncate(coords.getLongitude()));
    statusDisplay.setText("Available");
    currentLocation = location;
  } else {
    coordsDisplay.setText("--, --");
    statusDisplay.setText("Unavailable");
    currentLocation = null;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Each time the location of the device is updated, the location provider sends out the new location using the &lt;code&gt;Location&lt;/code&gt; parameter in the &lt;code&gt;locationUpdated&lt;/code&gt; method. The new location's coordinates can be picked using the
&lt;code&gt;getQualifiedCoordinates&lt;/code&gt; method.&lt;/p&gt; 

&lt;p&gt;Of course, if the device is out of range of the GPS satellites, then the provider will not be able to get the correct coordinates and,  therefore, the actual location will be either null or invalid. The method checks for this before updating the status and the current location of the device.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;providerStateChanged&lt;/code&gt; method accepts updates when the location provider goes in and out of range of the GPS satellites. However, I found that my implementation on the Nokia N95 did not reliably send out updates for the &lt;code&gt;providerStateChanged&lt;/code&gt; method. I therefore used the &lt;code&gt;locationUpdated&lt;/code&gt; method to find out the status of the provider, However, I have kept the code in the &lt;code&gt;providerStateChanged&lt;/code&gt;
in case it works on other devices.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;NOTE&lt;/b&gt;
&lt;p&gt;To be on the safe side, the code in the &lt;code&gt;locationUpdated&lt;/code&gt; method (and the corresponding &lt;code&gt;providerStateChanged&lt;/code&gt; method) should be in its own thread to make sure that it doesn't block the normal MIDlet thread.&lt;/p&gt;

&lt;h2&gt;Step 3: Store and list favorite spots&lt;/h2&gt;&lt;a name="3"&gt;&lt;/a&gt;

&lt;p&gt;Once the current location using the latitude and longitude have been found, it is a simple method to store this location with a tag as your favorite spot. The Location API makes it ridiculously simple by providing the Landmark store. You can either create your own Landmark store, or use the default one.&lt;/p&gt;

&lt;p&gt;The default Landmark store is shared by all the MIDlets within the device. You create a Landmark store by using the static method provided by the &lt;code&gt;LandmarkStore&lt;/code&gt; class. By passing in null, as shown in the following code, you are asking for the default store from this instance.&lt;/p&gt;

&lt;code&gt;&lt;pre&gt;
  store = LandmarkStore.getInstance(null);
&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;The Landmark store contains the details of a location using the &lt;code&gt;Landmark&lt;/code&gt; class. As shown in the following code, you can create a landmark by giving it a name (provide by you as a name for your favorite spot), a description (this is empty in the code below), and of course, the all important coordinates. The last parameter that is accepted by this constructor is an &lt;code&gt;AddressInfo&lt;/code&gt; object that can be used to store actual address information, if supported by the provider. In this case, I have kept these details as simple as possible.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
    // create the landmark
    Landmark landmark =
      new Landmark(name, "", currentLocation.getQualifiedCoordinates(), null);

    // and save it
    try {
      store.addLandmark(landmark, null);

      display.setCurrent(
        new Alert("Message", "Done", null, AlertType.INFO), displayForm);

      return;

    } catch(Exception ex) {
      handleError(ex);
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once you have created the landmark, you can store it in the store using the &lt;code&gt;addLandmark&lt;/code&gt; method. The second parameter specifies a category for that landmark, but I have kept it simple by putting it in the default category.&lt;/p&gt;

&lt;p&gt;The list of existing landmarks can be retrieved using the &lt;code&gt;getLandmarks&lt;/code&gt; method. This returns an enumeration that can be iterated over
to display to the user in a list. This is shown in the following code.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  Enumeration en = store.getLandmarks();
  while(en.hasMoreElements()) {
    Landmark landmark = (Landmark)en.nextElement();
    landmarkList.append(
      landmark.getName() +
      " - " +
      truncate(landmark.getQualifiedCoordinates().getLatitude()) + ", " +
      truncate(landmark.getQualifiedCoordinates().getLongitude()), null);
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt; &lt;a href="http://blogs.sun.com/mobility_techtips/resource/LocationTechTip.zip"&gt;Source code&lt;/a&gt; as a Netbeans project&lt;/li&gt;
&lt;li&gt; &lt;a href="http://jcp.org/en/jsr/detail?id=179"&gt;Location API (JSR 179)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/mKa5-_hRlDQ" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/using_the_location_api_for</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/blu_ray_disc_application_development2</id>
        <title type="html">Q&amp;A on Blu-ray Disc Application Development with Java ME</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/FsjqFAcdDZc/blu_ray_disc_application_development2" />
        <published>2009-04-01T11:57:39-07:00</published>
        <updated>2009-04-01T11:57:39-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="blu-ray" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javatv" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">In the past year, Sun published a two-part series to lower the learning curve for Java developers who want to get started using the Blu-ray Disc for Java (BD-J) platform. This follow-up tech tip answers a couple of questions from  readers.</summary>
        <content type="html">&lt;p&gt;&lt;i&gt;By &lt;a href="http://java.sun.com/features/authors.html#hopkins" target="_blank"&gt;Bruce Hopkins&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;Java technology is an integral part of the new high-definition video standard: the Blu-ray Disc standard. In the past year, Sun published a two-part series to lower the learning curve for Java developers who want to get started using the Blu-ray Disc for Java (BD-J) platform.&lt;/p&gt; 

&lt;p&gt;In &lt;a href="http://java.sun.com/developer/technicalArticles/javame/bluray/" target="_blank"&gt;Part 1: Creating Your First Application&lt;/a&gt;, I provided an introduction to the BD-J platform and provided information on the various APIs that are required by BD-J, including GEM/MHP (Globally Executable Multi Home Platform) and Java TV. In &lt;a href="http://java.sun.com/developer/technicalArticles/javame/bluray/part2/" target="_blank"&gt;Part 2: Responding to User Input&lt;/a&gt;, I showed you how to use the Java ME SDK to create an application that can respond to the user via the remote.&lt;/p&gt;

&lt;p&gt;Among the thousands of readers of this series, several readers submitted the following questions in the Comments section of the articles.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Question: Is it really a good idea to use org.havi and org.dvb classes? Will this work on &lt;i&gt;all&lt;/i&gt; Blu-ray players?&lt;/b&gt;&lt;/p&gt; 

&lt;p&gt;&lt;b&gt;Answer:&lt;/b&gt; Yes, it is perfectly fine to use any of the use org.havi and org.dvb classes that are a part of the BD-J specification. Specifically, those classes originate from the GEM/MHP layer of the BD-J software stack, and all Blu-ray players must support them. Please refer to Part 1, where I provide a complete list of all the Java packages that must be supported in all Blu-ray players on the market (including PC-based Blu-ray players).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Question: I have following the problem when I compile the source file:&lt;/b&gt;
&lt;pre&gt;
Fatal Error: Unable to find package java.lang in classpath or bootclasspath&lt;br /&gt;
Details message: &lt;javac includeantruntime="false"source="${javac.source}"&lt;br /&gt; target="${javac.target}"&lt;br&gt; deprecation="${javac.deprecation}" optimize="${javac.optimize}"&lt;br /&gt; debug="${javac.debug}"&lt;br&gt; srcdir="${buildsystem.baton}" destdir="${build.classes.dir}"&lt;br /&gt; bootclasspath="${platform.bootclasspath}"&lt;br&gt; includes="${javac.includes}"&lt;br /&gt; encoding="${javac.encoding}"&gt;
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Answer:&lt;/b&gt; If you’re using the &lt;a href="http://java.sun.com/javame/downloads/sdk30ea.jsp" target="_blank"&gt;Java ME SDK 3.0&lt;/a&gt; platform and you’re having a compilation error, then please refer to the instructions provided in Part 2: I list step-by-step instructions on how to set up the Java ME SDK 3.0 to compile BD-J applications. Note that the Java ME SDK 3.0 cannot compile BD-J applications in its default state after you install the SDK. It must be configured with the BD-J libraries to compile BD-J applications.

&lt;h3&gt;Final Thoughts&lt;/h3&gt;

Thanks to all the readers who took the time to provide feedback to this article series! Your input, thoughts, questions, and ideas are always welcome and appreciated.
&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/FsjqFAcdDZc" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/blu_ray_disc_application_development2</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/discovering_devices_and_sending_files</id>
        <title type="html">Discovering Devices and Sending Files via Bluetooth in Java ME</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/2cj6akeqBTs/discovering_devices_and_sending_files" />
        <published>2009-03-19T19:56:23-07:00</published>
        <updated>2009-03-19T19:56:23-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="bluetooth" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">Vikram Goyal shows you how to create a MIDlet that will search for Bluetooth-enabled devices and services, and then allow the user to send a simple note to one of the found devices.</summary>
        <content type="html">&lt;a href="http://java.sun.com/features/authors.html#goyal" target="_blank"&gt;By Vikram Goyal&lt;/a&gt;

&lt;p&gt;One of the first steps in implementing Bluetooth applications on Java ME devices is the discovery process. In a nutshell, the discovery process is the process by which Bluetooth-enabled devices find each other, and then handshake to find out the services that they can each support. The next step, invariably, is learning how to send data between these paired devices.&lt;/p&gt;

&lt;p&gt;In this tech tip, I will show you how to create a MIDlet that will search for devices and services, and then will allow the user to send a simple note to one of the found devices. I have tested and verified that the MIDlet works on a Nokia N95 device, and that it connects to a computer running Windows Vista, with Bluetooth support enabled.&lt;/p&gt;

&lt;p&gt;I have broken down the whole process into the following steps:
&lt;ol&gt;
    &lt;li&gt;Start the discovery process.&lt;/li&gt;
    &lt;li&gt;Query the devices found in the discovery process for supported services.&lt;/li&gt;
    &lt;li&gt;Initiate and process an OBEX data exchange using the supported service URL.&lt;/li&gt;
&lt;/ol&gt;

The following paragraphs elaborate on these steps. It may help to have the whole source code of this MIDlet available for review while following the code snippets in these steps. The source code is available as a zipped file under &lt;a href="#resources"&gt;Resources&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Step 1: Start the discovery process&lt;/h3&gt;
&lt;p&gt;The discovery process is used to tell the local Bluetooth stack that it should look within the nearby vicinity for any Bluetooth devices
that are available for pairing. In the case of the MIDlet, this stack will be the implementation provided by your device provider for
&lt;a href="http://jcp.org/en/jsr/detail?id=82" target="_blank"&gt;JSR 82&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This process of discovery is initiated by the discovery agent present in the local device, as shown in the following code.

&lt;pre&gt;&lt;code&gt;
    // get the local discovery agent
    agent = LocalDevice.getLocalDevice().getDiscoveryAgent();

    // start the inquiry for general unlimited inquiry
    agent.startInquiry(DiscoveryAgent.GIAC, this);
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;Once the discovery agent has started the discovery process, it will call various callback methods on a class that implements the &lt;code&gt;DiscoveryListener&lt;/code&gt; interface. In our case, this is our MIDlet class.&lt;/p&gt; 

&lt;p&gt;Specifically, four methods of this interface must be implemented, two of which are interest to us in the discovery phase: &lt;code&gt;deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)&lt;/code&gt; and &lt;code&gt;inquiryCompleted(int discType)&lt;/code&gt;. These two methods handle the discovery of a device and completion of the discovery process, respectively. As shown in the following code from the MIDlet, we
use these methods to append our UI with devices as they are discovered and when the process is completed.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
    try {
      // add the devices using the friendly names
      listofDevices.append(btDevice.getFriendlyName(false), null);
      // add to the devices hashtable
      devices.put(new Long(listofDevices.size()), btDevice);
    } catch(Exception ex) { handleError(ex); }
  }

  public void inquiryCompleted(int discType) {
    // once the inquiry is completed, show the list of devices to the user
    if(listofDevices.size() == 0) {
      display.setCurrent(nothing, noteBox);
    } else {
      display.setCurrent(listofDevices);
    }
  }
&lt;code&gt;&lt;/pre&gt;

&lt;h3&gt;Step 2: Start the service discovery on discovered devices&lt;/h3&gt;
&lt;p&gt;Since our aim in this tip is to allow data transfer from our MIDlet to a compatible device, we need to find services on the discovered devices that enable this goal. To do so, we need to specify the correct attributes and UUIDs in our service discovery process. The following code shows how to do so:

&lt;pre&gt;&lt;code&gt;
  agent.searchServices(
    null,
    new UUID[] {new UUID(0x1105L)}, // we want the OBEX PUSH Profile
    device,
    this);
&lt;code&gt;
&lt;/pre&gt;

As you may guess, the code uses the local agent that we had used earlier to search for devices. We are not after a particular set of attributes, so we pass null as the first parameter, but the UUID must be OBEX PUSH profile, as this is the most open way of transferring data.&lt;/p&gt;

&lt;p&gt;We talked about the DiscoveryListener interface which has two other methods that can be used to employ discovered services. These two methods are &lt;code&gt;servicesDiscovered(int transID, ServiceRecord[] servRecord)&lt;/code&gt; and &lt;code&gt;serviceSearchCompleted(int transID, int respCode)&lt;/code&gt;. As the names
suggest, the first method is called each time a service is discovered, while the second method is called when the service process has completed.&lt;/p&gt;

&lt;p&gt;Each time a service is discovered, we need to find out the connection URL for that particular service on the respective device. This connection URL will be used to make the OBEX connection for putting our data across, and consists of the Bluetooth hardware address of the device, among other things. In the code below, this connection URL is retrieved in the &lt;code&gt;servicesDiscovered&lt;/code&gt; method:

&lt;pre&gt;&lt;code&gt;
String connURL = servRecord[i].getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With this connection URL, we can now move to the process of transferring our data across to the discovered device.&lt;/p&gt;

&lt;h3&gt;Step 3: Send data using OBEX PUT&lt;/h3&gt;
&lt;p&gt;In this MIDlet, we are going to allow the user to type some text as a note, and then send that across using the discovered device/service. To do so,
we will need the connection URL we got in the previous step (and of course, the note data as a String).

&lt;pre&gt;
&lt;code&gt;
    // open a client session
    ClientSession clientSession =
      (ClientSession) Connector.open(connURL);

    // connect using no headers
    clientSession.connect(null);

    if(rHeaders.getResponseCode() != ResponseCodes.OBEX_HTTP_OK) {
      // the connection could not be established
      handleError(
        new Exception("Remote client returned invalid response code: " +
          rHeaders.getResponseCode()));
      return;
    }

    // if we are here, then response code was ok

    // create a new set of headers
    HeaderSet headers = clientSession.createHeaderSet();
    headers.setHeader(
      HeaderSet.LENGTH,
      new Long(noteBox.getString().length()));
    headers.setHeader(HeaderSet.NAME, "myNote.txt");
    headers.setHeader(HeaderSet.TYPE, "text/plain");

    // create an operation using the headers we have just created
    Operation op = clientSession.put(headers);

    // on this operation, create the output stream
    OutputStream out = op.openOutputStream();

    // and send the note
    out.write(noteBox.getString().getBytes());
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;To send the data, a client session is opened and a connection established with empty headers. At this point, your target device will ask for confirmation of  receipt of data from a new device. It may also ask you for a passkey if you have never paired the devices before.&lt;/p&gt;

&lt;p&gt;Once the connection is established, some headers that explain the purpose of the data are created, and a new &lt;code&gt;Operation&lt;/code&gt; created with these headers. The &lt;code&gt;Operation&lt;/code&gt; is then used to send the data via the available &lt;code&gt;OutputStream&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The received note will be available in the default Bluetooth exchange folder on the target device.&lt;/p&gt;

&lt;a name="resources"&gt;&lt;/a&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://blogs.sun.com/mobility_techtips/resource/BluetoothTechTip.zip"&gt;Source code&lt;/a&gt; as a Netbeans project&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://jcp.org/en/jsr/detail?id=82"&gt;Bluetooth JSR 82 API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/2cj6akeqBTs" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/discovering_devices_and_sending_files</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/three_reasons_why_your_next</id>
        <title type="html">Three Reasons Why Your Next Java ME Mobile Application Should Include JavaFX Mobile</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/GASSJXcTPAE/three_reasons_why_your_next" />
        <published>2009-02-06T12:01:11-08:00</published>
        <updated>2009-02-06T12:01:12-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobile" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">Developer Bruce Hopkins walks you through three source-code samples to demonstrate JavaFX's usefulness to Java ME developers creating apps for mobile devices. Developers can call methods on objects and instantiate objects within libraries that already exist in Java ME and Java SE -- in this case, the APIs in JSRs 82, 135, and 180. Plus, JavaFX let you bind the value of an object to another variable.</summary>
        <content type="html">&lt;p&gt;By &lt;a href="http://java.sun.com/features/authors.html"&gt;Bruce Hopkins&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's assume that you're in the middle of your development cycle, and you realize that your mobile application needs to perform some very important but non-GUI-related operations such as:
&lt;ul&gt;
&lt;li&gt; Discover a local Bluetooth device in the vicinity&lt;/li&gt;
&lt;li&gt; Communicate with a SIP registrar or proxy&lt;/li&gt;
&lt;li&gt; Determine your geo-location via a GPS device&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;

&lt;p&gt;So now what do you do? You want to write your killer-app using great declarative syntax of JavaFX, but you also realize that the Java standard specifications for Bluetooth wireless technology (JSR-82), SIP communication (JSR-180), and location-based application development (JSR-179) and are available as Java ME APIs.&lt;/p&gt;

&lt;p&gt;Fortunately, the JavaFX runtime is completely dependent upon (and compatible with) the Java virtual machine (JVM). Simply stated, it means the following:
&lt;ul&gt;
&lt;li&gt; Your JavaFX Mobile application has no restrictions on calling any class bundled in the JAR or any JSR API library that's present on the handset.&lt;/li&gt;
&lt;li&gt; Your JavaFX Desktop application will work seamlessly upon any deployment platform that has the current version of the JRE:
&lt;ul&gt;
&lt;li&gt; For Windows machines, this will be Java 6, update 11 (or later)&lt;/li&gt;
&lt;li&gt; For Mac OS X machines, this will be Java 5, update 13 (or later)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Independent of the operating system, your JavaFX Desktop application will also be able to call any class that's bundled in the JAR package for your desktop application. Note: On the Windows desktop, JavaFX runs on Java 5 and it degrades gracefully (for example, the Drag2Install feature does not work) — that is, it does not break your application.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/javame/javafxmobile-javame/"&gt;Read the full article,  with source code.&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/GASSJXcTPAE" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/three_reasons_why_your_next</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/notes_from_the_java_mobile</id>
        <title type="html">Notes from the Java Mobile, Media &amp; Embedded Developer Days</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/Ua0izVWikKc/notes_from_the_java_mobile" />
        <published>2009-01-21T16:16:32-08:00</published>
        <updated>2009-01-29T11:09:32-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="me" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobile" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;Here are notes from the presentations I attended at the &lt;a href="https://developerdays.dev.java.net/nonav/overview.html"&gt;Java Mobile, Media &amp; Embedded Developer Days&lt;/a&gt; (M3DD) today, at the Sun campus in Santa Clara, California.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;&lt;p&gt;&lt;i&gt;January 21, 2009, Wednesday. Sun Microsystems campus, Santa Clara, Caifornia.&lt;/i&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;These are notes from the presentations I attended at the &lt;a href="https://developerdays.dev.java.net/nonav/overview.html"&gt;Java Mobile, Media &amp; Embedded Developer Days&lt;/a&gt; (M3DD). For more details, please go to the M3DD website and view the specific &lt;a href="https://developerdays.dev.java.net/nonav/sessions.html"&gt;presentation's slides&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Sun Microsystems Mobile and Embedded community manager Roger Brinkley and evangelist Terrence Barr briefly welcomed the group to the second developer days, sponsored by &lt;a href="http://www.sonyericsson.com/cws/corporate/home"&gt;Sony Ericsson&lt;/a&gt; and Sun Microsystems, then launched into the packed agenda. While the numbers rose and fell during the day, there were some 100 participants at the conference and another 150 participating via the live stream.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Marketing VP Eric Klein and Engineering VP Jeet Kaul gave the keynote speech. Eric stressed that the 2009 keywords for Java are "open" and "expressive." Eric noted that customers today consume and create business and personal content 24x7, across the screens of their life (mobile, desktop, television).&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Eric spent some minutes reviewing Sun's "open" history, including the open collaboration around Java for over 12 years, resulting in Java being completely open source. Today's focus is on using Java to create a rich, immersive, expressive platform, so that developers can solve complex customer problems, using multiple data sources. The 6.5 million Java developers worldwide can combine with the 8 million content authors/web developers to grow a vibrant mobile platform. Jeet talked about his focus on streamlining the designer-developer workflow, embracing the native tools used by the community.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Jeet and Eric spoke of two current initiatives to address fragmentation issues: &lt;a href="http://java.sun.com/products/java-odp/"&gt;Java ODP&lt;/a&gt; and &lt;a href="http://java.sun.com/javafx/"&gt;JavaFX&lt;/a&gt;. Java On Device Portal (ODP) allows the use of mobile widgets across global mobile devices, while JavaFX is positioned as the unifying technology for rich internet applications (RIA), web, and Java development across all screens (desktop, mobile, television). Eric also talked about &lt;a href="http://www.sun.com/software/products/hydrazine/"&gt;Project Hydrazine&lt;/a&gt; (aka rocket fuel), which is an initiative to develop internet and operator services.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Florian Tournier, Sun senior product line manager, presented an overview of the Java mobility roadmap. First, the numbers:&lt;br/&gt;
&lt;ul&gt;&lt;br/&gt;
&lt;li&gt; 2.6 billion Java phone base&lt;br/&gt;
&lt;li&gt; 6 billion Java Cards deployed&lt;br/&gt;
&lt;li&gt; 840 million Java-enabled desktops&lt;br/&gt;
&lt;li&gt; 40 million+ Blu-ray and TV devices&lt;br/&gt;
&lt;/ul&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Florian stressed Sun's continuing commitment to open source and standards. Open source is exemplified by the regular &lt;a href="https://phoneme.dev.java.net/"&gt;phoneME&lt;/a&gt; releases -- phoneME Feature being the open-source implementation based on &lt;a href="http://java.sun.com/javame/technology/index.jsp#cldc"&gt;CLDC&lt;/a&gt; and &lt;a href="http://java.sun.com/products/midp/overview.html"&gt;MIDP&lt;/a&gt;, while phoneME Advanced is an open-source implementation of CDC for consumer devices and advanced phones -- and the open-sourcing of the &lt;a href="http://java.sun.com/developer/technicalArticles/javame/lwuit_intro/index.html"&gt;LWUIT&lt;/a&gt; interface. LightWeight User Interface Toolkit (LWUIT), a standalone library, creates rich UIs easily for Java apps, which runs on any CLDC 1.1/MIDP 2.0 device. Standards are demonstrated by the &lt;a href="http://java.sun.com/javame/technology/msa/"&gt;Mobile Service Architecture (MSA)&lt;/a&gt; platform for Java in wireless, industry initiatives against fragmentation, and popular development/testing tools.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;For 2009, Florian foresees the return of the feature (as opposed to smart) phone, with increasingly expressive experiences. He sees more emphasis on the browser, so discussed JSR 290, the mobile browser APIs for Java ME, mobile web servers (such as the Sprint Titan architecture), and Java Card 3. Innovations in Java show up in &lt;a href="http://java.sun.com/developer/technicalArticles/javame/msa2-intro/index.html"&gt;MSA2/MIDP3&lt;/a&gt; functionality, CDC on phone (&lt;a href="http://developers.sun.com/mobility/community/sprint-adp/index.jsp"&gt;Sprint Titan&lt;/a&gt; with OSGi), modularization (Java SE first, then Java ME), and testing and tools in the Java ME SDK, with CLDC/CDC and BD-J support.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Phil Bender of CableLabs was the speaker at the next talk I attended. &lt;a href="http://www.tru2way.com/"&gt;tru2way&lt;/a&gt; is Java-based middleware that allows interactivity with the television set, without requiring cable-top boxes. OpenCable project is on java.net, and there will be a developers conference on February 10. CableLabs also has a Visiting Engineer program. Cognizant's visiting engineer did a TeenLocator app, ported from Cognizant's IMS app for mobile, that lets users find a family member's mobile phone and map its location with driving directions. &lt;/p&gt;


&lt;p&gt;&lt;p&gt;The new &lt;a href="http://java.sun.com/javame/technology/javatv/"&gt;Java TV standard for digital TV in Brazil&lt;/a&gt; came next, by Sun's Michael Lagally and Jens Pätzold. Interactive TV (TV plus apps) lets you augment A/V with Java apps, which are synchronized to the A/V content. Brazil has the world's largest dual terrestrial-mobile TV deployment. It has the world's 4th largest TV network (around 80 million viewers a day), so the Brazilian goverment has a standards body (Sistema Brasileiro de Televisao Digital, or SBTVD), which requested Sun to create royalty-free DTV specification. People use television to connect to the internet in Brazil, so it is used for many things as eGovernment apps (such as to obtain a driver's license).&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Several lightning talks followed, with each person having 7 minutes to introduce his or her material. Patrick Curran talked about the &lt;a href="http://java.sun.com/javame/technology/jcp.jsp"&gt;Java Community Process (JCP)&lt;/a&gt;. and noted there are 26 active Java ME JSRs. Nokia's Jackson Feijo Filho gave usability testing tips for mobile developers, including a usability checklist. Gail Rahn Frederick talked about multi-modal search in On Device Portals, and &lt;a href="http://www.mediosystems.com/"&gt;Medio Systems'&lt;/a&gt; handset-resident mobile search-driven ODP application, requiring JSR 135. SunLabs' Eric Arseneau showed a &lt;a href="http://tinyurl.com/meddfirst"&gt;video on First&lt;/a&gt;, which will tie into his Project Squawk presentation on January 22.&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Next, Ken Gilmer of &lt;a href="www.buglabs.net"&gt;Bug Labs&lt;/a&gt; talked about mobile Java on the BUG programmable and modular open-source gadget platform, which lets you use electronic building blocks to build personalized hardware devices. The BUG device is a mobile Linux computer in a small metal rectangle, the size of an older clunky mobile phone, with several pluggable modules (e.g., camera, LCD, GPS, and the lovely Von Hippel breakout board). It contains an OSGi runtime on a CDC JVM (Concierge on phoneME) and has an SDK with a virual BUG emulator. &lt;/p&gt;


&lt;p&gt;&lt;p&gt;That's it for today's presentation notes. If you'd like to follow the rest of today's or tomorrow's sessions, you can &lt;a href="http://www.ustream.tv/sun"&gt;stream the conference&lt;/a&gt;. If needed, find the &lt;a href="http://www.ustream.tv/sun"&gt;instructions here.&lt;/a&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/Ua0izVWikKc" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/notes_from_the_java_mobile</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/mixing_midi_tone_and_sampled</id>
        <title type="html">Mixing MIDI, Tone, and Sampled Audio using MMAPI</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/CAUuuc9wA5I/mixing_midi_tone_and_sampled" />
        <published>2009-01-20T15:10:36-08:00</published>
        <updated>2009-02-04T08:13:58-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="me" scheme="http://roller.apache.org/ns/tags/" />
        <category term="media" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mmapi" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobiiity" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobile" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">&lt;p&gt;In this tech tip, Vikram Goyal shows you how to mix and play multiple media content at the same time. He uses the Mobile Media API (MMAPI) and the NetBeans IDE.&lt;/p&gt;
</summary>
        <content type="html">&lt;p&gt;&lt;i&gt;&lt;a href="#bio"&gt;By Vikram Goyal&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Mobile Media API (MMAPI) is a protocol- and format-agnostic API for playing
  and manipulating multimedia content in mobile devices. It is a diverse API and
  handles several different types of media seamlessly, depending upon device capabilities.
  In this tech tip, you will learn how to mix and play multiple media content
  at the same time.&lt;/p&gt;
&lt;h2&gt;Understanding the issues of mixing in MMAPI&lt;/h2&gt;
&lt;p&gt;On the face of it, mixing sounds in a mobile applications is a desirable attribute
  to have, especially for multimedia-rich applications like games. MMAPI provides
  you the ability to mix different media, but there are pitfalls. The following
  sections describe some of these issues.&lt;/p&gt;
&lt;h3&gt;Device fragmentation&lt;/h3&gt;
&lt;p&gt;MMAPI implementations that return a value of true for &lt;code&gt;supports.mixing&lt;/code&gt; system
  property should, in theory, be able to do the following.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Support the playing of at least two tones simultaneously,&lt;/li&gt;
  &lt;li&gt;Use &lt;code&gt;Manager.playTone()&lt;/code&gt; when another player instance
    is playing back audio, and&lt;/li&gt;
  &lt;li&gt;Support the playback of at least two instances of audio players.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In practice, not all MMAPI implementations follow these guidelines. This is
  due to device fragmentation. You should consult the design guidelines supplied
  by the device manufacturer to find out the capabilities of the device that you
  are working with.&lt;/p&gt;
&lt;h3&gt;Multiple player instances&lt;/h3&gt;
&lt;p&gt;With multiple player instances active in an application, there is a danger
  of too many resources being taken up to service these instances. When a player
  instance is in a prefetched/realized state, it will become a memory liability
  if kept around for a long time, especially because player instances in this
  state can request exclusive access to system resources, like the audio hardware.
  Thus, even if your device's MMAPI implementation allows for more than 2 player
  instances to be active at any time, it is prudent to keep this number low.&lt;/p&gt;
&lt;h3&gt;MIDI, tones, and sampled audio&lt;/h3&gt;
&lt;p&gt;As I said earlier, what can be mixed depends on your device's MMAPI implementation.
  Generally, most implementations will allow you to mix one instance of sampled
  audio and one instance of either a simple tone or MIDI sound, or both.&lt;/p&gt;
&lt;h2&gt;Putting together the code&lt;/h2&gt;
&lt;p&gt;Mixing sounds is a common feature in games where a background sound plays
  throughout the game, while various user or application events generate their
  own short lived sounds. In the &lt;a href="#code"&gt;following example&lt;/a&gt;, I will use a basic sampled
  audio as a background score, while various events during the game play will
  be mixed using MIDI and Tone control. The example is created and run using Netbeans
  6.5. Make sure that MMAPI is selected as an optional API while
  creating this application, as MIDIControl is not part of the basic MIDP 2.0
  MMAPI package.&lt;/p&gt;

&lt;p&gt;When you run this code (supplied as a &lt;a href="http://blogs.sun.com/mobility_techtips/resource/mmapi-src.zip"&gt;Netbeans project&lt;/a&gt;),
  you will be able to mix a MIDI sound and a system-generated tone with the continuous
  background music. This is tested in Sun Wireless Toolkit 2.2 supplied with Netbeans.
  If you run this in other toolkits, or better still, on an actual device, you
  will need to make sure that MIDIControl is supported.&lt;/p&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://blogs.sun.com/mobility_techtips/resource/mmapi-src.zip"&gt;Source code&lt;/a&gt; as a Netbeans project&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://java.sun.com/javame/technology/msa/jsr135.jsp"&gt;Mobile Media API&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://www.amazon.com/Pro-Java-ME-MMAPI-Mobile/dp/1590596390"&gt;Mobile
    Media API Book&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;

&lt;p&gt;EXAMPLE SOURCE CODE&lt;/p&gt;
&lt;a name="code"&gt;&lt;/a&gt;
&lt;pre&gt;&lt;code&gt;/*
 * TechnicalTipMIDlet.java
 *
 */

import javax.microedition.media.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.media.control.MIDIControl;

/*
 * TechnicalTipMIDlet mixes audio, MIDI and tone
 * @author  Vikram Goyal
 */
public class TechnicalTipMIDlet extends MIDlet implements CommandListener {

  // define variables

  // the players for background music and MIDI
  private Player backgroundMusic = null;
  private Player aPlayer = null;

  // the MIDIControl extracted from aPlayer
  private MIDIControl mControl = null;

  // display items, the display
  private Display display = null;

  // and an alert
  private Alert alert = null;

  // commands to exit, for aCommand (MIDI) and bCommand (tone)
  private Command exitCommand = null;
  private Command aCommand = null;
  private Command bCommand = null;

  public TechnicalTipMIDlet() {

    // initialize the display
    display = Display.getDisplay(this);

    // a message for the user
    alert = new Alert("Message");
    alert.setString("Press A to play a tone, Press B to play a MIDI");
    alert.setTimeout(Alert.FOREVER);

    // create commands
    exitCommand = new Command("Exit", Command.EXIT, 1);
    aCommand = new Command("A", Command.ITEM, 1);
    bCommand = new Command("B", Command.ITEM, 1);

    // add to alert
    alert.addCommand(exitCommand);
    alert.addCommand(aCommand);
    alert.addCommand(bCommand);

    // set this class as command listener
    alert.setCommandListener(this);

    // and initialize the player instances
    initialize();
  }

  private void initialize() {

    // create and prefetch player instances
    try {

      // for the background music, load a simple wav file and put it on
      // infinite loop
      backgroundMusic =
        Manager.createPlayer(
          getClass().getResourceAsStream("music.wav"), "audio/x-wav");
      backgroundMusic.prefetch();
      backgroundMusic.setLoopCount(-1);

      // create the MIDI player, prefetch
      aPlayer = Manager.createPlayer(Manager.MIDI_DEVICE_LOCATOR);
      aPlayer.prefetch();

      // and extract the MIDIControl
      mControl =
        (MIDIControl)aPlayer.getControl(
          "javax.microedition.media.control.MIDIControl");

    } catch(Exception ex) {
      handleError(ex);
    }
  }

  public void commandAction(Command cmd, Displayable disp) {

    // handle the exit command
    if(cmd == exitCommand) {
      destroyApp(true);
      notifyDestroyed();
      return;
    }

    try {

      // if it's the aCommand
      if(cmd == aCommand) {

        // play a short MIDI event
        mControl.shortMidiEvent(MIDIControl.NOTE_ON | 11, 60, 100);
      }

      if(cmd == bCommand) {

        // if bCommand, use the Manager class to play a simple tone
        Manager.playTone(61, 1000, 100);
      }
    } catch(Exception ex) {
      handleError(ex);
    }
  }

  public void startApp() {

    try {

      // start the background music if it was created successfully
      if(backgroundMusic != null) backgroundMusic.start();
      else handleError(new Exception("Error with background player"));
    } catch(Exception ex) { handleError(ex); }

    display.setCurrent(alert);
  }

  public void pauseApp() {
  }

  public void destroyApp(boolean unconditional) {

    try {

      // close players
      if(backgroundMusic != null) {
        backgroundMusic.close();
        backgroundMusic = null;
      }

      if(aPlayer != null) {
        aPlayer.close();
        aPlayer = null;
      }

    } catch(Exception e) {
      handleError(e);
    }

  }

  // handles errors
  private void handleError(Exception ex) {
    alert.setTitle("Error");
    alert.setString(ex.getMessage());
    display.setCurrent(alert);
    ex.printStackTrace();
  }
}&lt;/code&gt;&lt;/pre&gt;

&lt;hr&gt;
&lt;a name="bio"&gt;&lt;/a&gt;
&lt;p&gt;&lt;i&gt;Vikram Goyal is the author of &lt;a href="http://www.amazon.com/gp/product/1590596390/ref=sr_11_1/103-6578893-2197420?%5Fencoding=UTF8"&gt;Pro Java ME MMAPI&lt;/a&gt;, published by &lt;a href="http://www.apress.com/book/bookDisplay.html?bID=10101"&gt;Apress&lt;/a&gt;. This book explains how to add audio, video and other multimedia capabilities to a Java-enabled phone. Vikram is also the author of the &lt;a href="http://www.manning.com/goyal"&gt;Jakarta Commons Online Bookshelf&lt;/a&gt; and helps manage a &lt;a href="http://www.craftbits.com/"&gt;free craft projects&lt;/a&gt; website.&lt;/i&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/CAUuuc9wA5I" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/mixing_midi_tone_and_sampled</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/blu_ray_disc_application_development1</id>
        <title type="html">Blu-ray Disc Application Development with Java ME, Part 2: Responding to User Input</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/vjU0GuImOXg/blu_ray_disc_application_development1" />
        <published>2009-01-07T15:55:34-08:00</published>
        <updated>2009-01-07T16:06:09-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="blu-ray" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javatv" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;Bruce Hopkins serves up Part 2 of his series on Blu-ray Disc Java development. Part 2 extends the code that was used in the Part 1, so that the application can respond to user input. Of course, since a Blu-ray Disc player is a set-top device, you can't expect users to interact with it with a keyboard and mouse. So we're going to look at the APIs involved in responding to input from a remote control, regardless of whether the user used an infrared remote control or Bluetooth remote control (such as the one used on the Sony Playstation 3, or PS3, gaming console). &lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;&lt;p&gt;&lt;i&gt;&lt;a href="http://java.sun.com/features/authors.html#hopkins"&gt;Bruce Hopkins&lt;/a&gt; serves up Part 2 of his series on Blu-ray Disc Java development.&lt;/i&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Part 1 introduces the BD-J platform and discusses the significant differences between the system requirements for developing, compared to playing, Blu-ray content. Additionally, we learn that the BD-J platform comprises various other supporting APIs, including GEM/MHP (Globally Executable Multi Home Platform) and Java TV. We are introduced to the application lifecycle of BD-J Xlets.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;In Part 2, Hopkins delves into the Java ME SDK 3.0, which is the perfect tool for all Java ME development — whether you're doing Blu-ray application development or mobile phone application development. The Java ME SDK 3.0 provides substantial enhancements to its predecessor, the Wireless Toolkit for CLDC 2.5, mainly due to the fact that it allows developers the ability to author, edit, and compile all Java ME applications — especially of course, BD-J applications. Using the BD-J APIs, developers can create Java ME applications for all Blu-ray disc players, including the Sony PlayStation 3 gaming console.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/javame/bluray/part2/"&gt;Read the full article&lt;/a&gt;&lt;/p&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/vjU0GuImOXg" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/blu_ray_disc_application_development1</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/early_access_to_java_on</id>
        <title type="html">Early Access to Java On Device Portal SDK</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/rAXh9GjPKSk/early_access_to_java_on" />
        <published>2008-12-09T21:53:33-08:00</published>
        <updated>2008-12-09T21:53:33-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="me" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;The new Java On Device Portal (ODP) lets developers use Java technology to&lt;br/&gt;
create and deploy widgets on mobile devices. Register now to join the&lt;br/&gt;
Early Access program.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;A Java mobile widget is a small chunk of Java ME code installed and operated by the &lt;a href="http://java.sun.com/products/java-odp/technologies/"&gt;Java On Device Portal (Java ODP)&lt;/a&gt; technology.&lt;/p&gt;


&lt;p&gt;While other Java ODP solutions force developers to write mobile widgets using a proprietary scripting language, the Java ODP platform leverages Java ME technology. You can write widgets in pure Java and take advantage of Java's full capabilities, such as packages for Personal Information Management (PIM), location-based services (LBS), multimedia, and more.&lt;/p&gt;


&lt;p&gt;&lt;img src="http://blogs.sun.com/mobility_techtips/resource/approach.gif" /&gt;&lt;/p&gt;


&lt;p&gt;&lt;a href="http://java.sun.com/products/java-odp/downloads/"&gt;Register here&lt;/a&gt; to join program to receive access to the Early Access SDK.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/rAXh9GjPKSk" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/early_access_to_java_on</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/how_to_develop_and_run</id>
        <title type="html">JavaFX and JNLPs: How to Develop and Run JavaFX Applets and Applications Offline</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/-Oor6fLGQAg/how_to_develop_and_run" />
        <published>2008-12-03T21:42:54-08:00</published>
        <updated>2008-12-04T11:32:29-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;This tech tip by Sun software engineer Thomas Ng describes how to run Java Network Launch Protocol (JNLP) files offline, such as for debugging or testing applets or applications developed with JavaFX. &lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;&lt;i&gt;&lt;a href="#byline"&gt;By Thomas Ng&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;While developing your JavaFX applet or application by using NetBeans IDE 6.5 for the JavaFX 1.0 platform, you might want to run the JavaFX application/applet offline for debugging and testing purposes. Following are the steps to run the JavaFX application or applet when your machine is disconnected from the network.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;b&gt;Requirements:&lt;/b&gt;  &lt;/p&gt;


&lt;p&gt;&lt;p&gt;You must have Java SE Development Kit (JDK) 6 Update 10 (or later) installed on your local machine.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Your applet or application must be JNLP enabled.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;1. Download the following files to your local machine:&lt;br/&gt;
   &lt;ul&gt;http://java.com/js/deployJava.js &lt;br/&gt;
   http://dl.javafx.com/dtfx.js&lt;br/&gt;
   http://dl.javafx.com/javafx-loading-100x100.gif&lt;br/&gt;
   http://dl.javafx.com/javafx-loading-25x25.gif&lt;/ul&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;2. Save the files to a local directory on your machine. For example:&lt;br/&gt;
   &lt;ul&gt;c:\offline\deployJava.js&lt;br/&gt;
   c:\offline\dtfx.js&lt;br/&gt;
   c:\offline\javafx-loading-100x100.gif&lt;br/&gt;
   c:\oflline\javafx-loading-25x25.gif&lt;/ul&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;3. Edit the &lt;code&gt;dtfx.js&lt;/code&gt; file:&lt;br/&gt;
   &lt;ul&gt;a. Replace the reference to &lt;code&gt;http://java.com/js/deployJava.js&lt;/code&gt; with &lt;code&gt;file:/c:/offline/deployJava.js&lt;/code&gt;.&lt;br/&gt;
   b. Replace the reference to &lt;code&gt;http://dl.javafx.com/javafx-loading-100x100.gif&lt;/code&gt; with &lt;code&gt;file:/c:/offline/javafx-loading-100x100.gif&lt;/code&gt;.&lt;br/&gt;
   c. Replace the reference to &lt;code&gt;http://dl.javafx.com/javafx-loading-25x25.gif&lt;/code&gt; with &lt;code&gt;file:/c:/offline/javafx-loading-25x25.gif&lt;/code&gt;.&lt;/ul&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;4. While your machine is connected to the network, run the following command, which ensures that the latest JavaFX runtime is installed into your local cache:&lt;br/&gt;
   &lt;ul&gt;&lt;code&gt;javaws -import http://dl.javafx.com/javafx-cache.jnlp&lt;/code&gt;&lt;br/&gt;
This command ensures the latest JavaFX runtime is cached in your system. You will see a Java splash screen, followed by a progress dialog box, if any download takes place.  After that, the command will exit silently, which means you now have the latest JavaFX runtime cached. If an error is encountered, an error dialog box  appears.&lt;br/&gt;
&lt;/ul&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;5. Disconnect your machine from the network.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;6. Ensure that the JNLP file for your JavaFX applet or application uses the following &lt;code&gt;&amp;lt;extension&amp;gt;&lt;/code&gt; tag for its JavaFX runtime:&lt;br/&gt;
   &lt;ul&gt;&lt;code&gt;&amp;lt;extension name="JavaFX Runtime" href="http://dl.javafx.com/javafx-rt.jnlp"/&amp;gt;&lt;/code&gt;&lt;br/&gt;
   This is the default that is generated by the NetBeans IDE. This allows your application/applet to be launched offline by using the cached JavaFX runtime.&lt;/ul&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;7. In your applet or application HTML page, change the reference of &lt;code&gt;dtfx.js&lt;/code&gt; to your local copy.&lt;br/&gt;
   &lt;ul&gt;a. For example, find this reference: &lt;code&gt;&amp;lt;script src="http://dl.javafx.com/dtfx.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;br/&gt;
   b. Change it to the following: &lt;code&gt;&amp;lt;script src="file:/c:/offline/dtfx.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/ul&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;8. Run your application or applet offline.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;The compile and run functions of the NetBeans IDE always regenerate the HTML and JNLP files of your JavaFX applet or application and overwrite the changes you made to default value of &lt;code&gt;http://dl.javafx.com&lt;/code&gt; instead of to your local copy. Therefore, you must make a copy of these offline-specific HTML and JNLP files and navigate to them directly when running offline. Remember to change the JNLP href in each offline JNLP file that points to the offline copy.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;You can continue to work on your JavaFX applets and applications while your computer is offline.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;a name="byline"&gt;&lt;/a&gt;&lt;br/&gt;
&lt;i&gt;Thomas Ng is a software engineer in the Java Deployment team at Sun Microsystems. He has worked on developing Java Web Start software since version 1.0.&lt;/i&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/-Oor6fLGQAg" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/how_to_develop_and_run</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/report_from_africa_a_java</id>
        <title type="html">Report from Africa: A Java ME MIDlet for User-Generated Localization</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/hR3p8h18Ym8/report_from_africa_a_java" />
        <published>2008-11-03T16:14:43-08:00</published>
        <updated>2008-11-03T16:14:43-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="localization" scheme="http://roller.apache.org/ns/tags/" />
        <category term="midlets" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;In this article, the authors describe the process of developing a user-generated localization MIDlet for an application that connects people to community radio stations -- important purveyors of information in technology-challenged Africa.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;&lt;p&gt;&lt;i&gt;This article is by J.D. Moore (User Experience manager, Emerging Market Services, Nokia) and Daniel Orwa Ochieng (lecturer at the School of Computing and Informatics at the University of Nairobi's College of Biological and Physical Sciences, Kenya).&lt;/i&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;Mobile user-interface heuristics have shown these factors as critical in ease-of-use:&lt;br/&gt;
&lt;ul&gt;&lt;br/&gt;
&lt;li&gt; Be consistent and build on experiences found locally in the user's environment&lt;br/&gt;
&lt;li&gt; Offer efficient menus, avoiding deep hierarchies -- particularly critical where there is rampant illiteracy.&lt;br/&gt;
&lt;li&gt; Provide clear feedback in the local language, for optimum comprehension.&lt;br/&gt;
&lt;li&gt; Let the user be in control, including decisions on resource usage (cost control).&lt;br/&gt;
&lt;li&gt; Simplify dialog boxes and navigation, and expect to deal with diversity via a simple user interface.&lt;br/&gt;
&lt;li&gt; Offer useful text labels with localized iconography (culturally sensitive).&lt;br/&gt;
&lt;/ul&gt;&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;As an example of these theories in action, Gergely Herenyi of Nokia developed an FM Radio Reference MIDlet, posted on the Nokia Forum. The MIDlet supports user-generated localization for an application to connect people to community radio stations. You can download the full source code from that site as well.&lt;/p&gt;&lt;/p&gt;


&lt;p&gt;&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/javame/africa/"&gt;Read the full article&lt;/a&gt;&lt;/p&gt; &lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/hR3p8h18Ym8" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/report_from_africa_a_java</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/asynchronous_communications_with_java_me1</id>
        <title type="html">Asynchronous Communications with Java ME and SIP: Part 2</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/rFoP3CBCO0c/asynchronous_communications_with_java_me1" />
        <published>2008-10-31T09:53:04-07:00</published>
        <updated>2008-11-03T10:08:46-08:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">Bruce Hopkins uses a SIP proxy and the REGISTER method type to provide a simple, yet scalable solution for sending a simple message asynchronously from one application to the other, when one SIP device is behind a firewall.</summary>
        <content type="html">&lt;p&gt;By &lt;a href="http://java.sun.com/features/authors.html#hopkins"&gt;Bruce Hopkins&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you may recall from &lt;a href="http://blogs.sun.com/mobility_techtips/entry/asynchronous_communications_with_java_me"&gt;Part 1&lt;/a&gt; of this series, I showed you two example applications that used the &lt;a href="http://java.sun.com/javame/technology/msa/jsr180.jsp"&gt;Session Initiation Protocol (SIP)&lt;/a&gt; to send a simple message asynchronously from one application to the other. In this tech tip, we are going to explore why the REGISTER method type is important and learn how to use it. 

&lt;p&gt;The SIP protocol supports the following method types when SIP devices are communicating:

&lt;table align="center" width="50%" cellpadding="2"&gt;
&lt;tr&gt; &lt;td&gt;ACK&lt;/td&gt;&lt;td&gt;MESSAGE&lt;/td&gt;&lt;td&gt;REFER&lt;/td&gt;
&lt;tr&gt; &lt;td&gt;BYE&lt;/td&gt;&lt;td&gt;NOTIFY&lt;/td&gt;&lt;td&gt;REGISTER&lt;/td&gt;
&lt;tr&gt; &lt;td&gt;CANCEL&lt;/td&gt;&lt;td&gt;OPTIONS&lt;/td&gt;&lt;td&gt;SUBSCRIBE&lt;/td&gt;
&lt;tr&gt; &lt;td&gt;INFO&lt;/td&gt;&lt;td&gt;PRACK&lt;/td&gt;&lt;td&gt;UPDATE&lt;/td&gt;
&lt;tr&gt; &lt;td&gt;INVITE&lt;/td&gt;&lt;td&gt;PUBLISH&lt;/td&gt;&lt;td&gt;&lt;/td&gt; 
&lt;/table&gt;

&lt;p&gt;In the previous example, you saw how easy it was for each user to communicate with each other using the MESSAGE method type. This was, of course, due to the fact that each user had a routable IP address, and there were no barriers in place (such as a firewall) to impede the communication between the devices. This gets a little tricky, however, when one or both of the users are located behind a firewall or NAT proxy as shown in Figure 1.

&lt;p align="center"&gt;&lt;img src="http://blogs.sun.com/mobility_techtips/resource/fig_1-sip2.png" alt="Incoming-Outgoing SIP Traffic" width="386" height="99" /&gt;&lt;/p&gt;

&lt;p align="center"&gt;&lt;b&gt;Figure 1. Incoming Requests to Devices Behind a Firewall Are Blocked&lt;/b&gt;

&lt;p&gt;If you're lucky, you can always ask the network administrator at your organization to open a port on the firewall for your device. However, that solution is definitely not scalable -- what if other people in your company wanted a port open for their devices, too?  Additionally, what would you need to do if the IP address of your mobile device changed? Your network administrator would have to reconfigure the firewall to point to your new address. Figure 2, below, shows the scalability problem if you open a port on the firewall for each SIP device.

&lt;p align="center"&gt;&lt;img src="http://blogs.sun.com/mobility_techtips/resource/fig_2-sip2.png" alt="Incoming SIP" width="525" height="257" /&gt;&lt;/p&gt; 

&lt;p align="center"&gt;&lt;b&gt;Figure 2: Opening Individual Ports on the Firewall for Incoming SIP Requests Is Not a Scalable Solution&lt;/b&gt;

&lt;p&gt;Obviously, there must be a scalable solution for multiple SIP devices to communicate if one or more of them are located behind a firewall. Fortunately, that's where the REGISTER method type comes into play. As you can see in Figures 3 and 4 below, the use of a SIP proxy and the REGISTER method type provide a simple, yet scalable solution. When a SIP device is behind a firewall, it needs to send a REGISTER method type to the external SIP proxy located outside the firewall. For the purposes of this tech tip, the external SIP proxy will also act as a registrar.

&lt;p align="center"&gt;&lt;img src="http://blogs.sun.com/mobility_techtips/resource/fig_3-sip2.png" alt="SIP Proxy" width="578" height="272" /&gt;&lt;/p&gt;
 
&lt;p align="center"&gt;&lt;b&gt;Figure 3. REGISTER Requests are Sent Directly to External SIP Proxy&lt;/b&gt;

&lt;p align="center"&gt;&lt;img src="http://blogs.sun.com/mobility_techtips/resource/fig_4-sip2.png" alt="Incoming SIP Routing" width="616" height="272" /&gt;&lt;/p&gt;
 
&lt;p align="center"&gt;&lt;b&gt;Figure 4. Incoming SIP Messages Are Now Routed to the Proper Devices&lt;/b&gt;

&lt;p&gt;What happens when your SIP device get a new IP address? All it needs to do is send a new RIGISTER request to the SIP proxy with its new IP address – and that’s it! The SIP Proxy will route all messages to your device now that it knows how to contact you. 

&lt;p&gt;If you want to try this out yourself, all you need to do is to standup the embedded SIP Proxy/Registrar inside the &lt;a href="http://java.sun.com/products/sjwtoolkit/download.html"&gt;Sun Java Wireless Toolkit 2.5.2&lt;/a&gt; application. To start the SIP proxy, execute the “Utilities” application with the Wireless Toolkit program group. After the Utilities application starts, click on the “Start SIP Server” option. After the server starts, you can then now register yourself with the SIP Proxy by sending to it a REGISTER message. The code in Listing 1 provides a practical example on how it is done:

&lt;pre&gt;
    public void register(final SipClientConnectionListener listener, final Thread waitFor){
        Thread t = new Thread() {
                public void run() {
                    runGauge();

                    try {
                        try {
                            if (waitFor != null) {
                                waitFor.join();
                            } else {
                            }
                        } catch (InterruptedException ie) {
                        }

                        scc = (SipClientConnection)Connector.open("sip:" + proxyAddress +
                                ":5060;transport=udp");
                        scc.setListener(listener);
                        scc.initRequest("REGISTER", scn);

                        String adr =
                            myDisplayName + " &lt;sip:" + myName + "@" + scn.getLocalAddress() + ":" +
                            scn.getLocalPort() + "&gt;";
                        scc.setHeader("To", adr);
                        scc.setHeader("From", adr);
                        scc.setHeader("Content-Length", "0");
                        scc.setHeader("Max-Forwards", "6");
                        uaStatus.setStatus(REGISTERING);
                        scc.send();
                        uaStatus.waitUntilChanged();
                        progressGaugeFinished = true;
                    } catch (Exception e) {
                        e.printStackTrace();
                        failMessage = e.getMessage();
                        commandAction(failedCmd, currentDisplay);

                        return;
                    }
                }
            };

        t.start();
    }
&lt;/pre&gt;

&lt;p align="center"&gt;&lt;b&gt;Listing 1. Using the JSR-180 API to Create and Send a Register Request&lt;/b&gt;

&lt;p&gt;The following image shows the results of the REGISTER request that was sent to my SIP Proxy. As you can see, I am now registered with the proxy. Now anyone can send a message to me via the proxy. Be sure to note that the proxy also functions a handy debug tool, and it shows you the contents of the SIP messages that it proxies.

&lt;p align="center"&gt;&lt;img src="http://blogs.sun.com/mobility_techtips/resource/fig_5-sip2.png" alt="REGISTER Request" width="568" height="548" /&gt;&lt;/p&gt; 

&lt;p align="center"&gt;&lt;b&gt;Figure 5. The Result of the REGISTER Request Sent to the SIP Proxy&lt;/b&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;It doesn’t take a lot of effort to use the JSR-180 API to register your device with a SIP Proxy/Registrar. If you’re looking for a fully functioning example, be sure to try out the GoSIP demo application in the &lt;a href="http://java.sun.com/products/sjwtoolkit/download.html"&gt;Sun Java Wireless Toolkit 2.5.2&lt;/a&gt;*. This application works out-of-the-box with the embedded SIP Proxy in the Wireless Toolkit, so that you can register multiple devices and to communicate via the proxy.

&lt;p&gt;*&lt;i&gt;NOTE: The Sun Wireless Toolkit is called the &lt;a href="http://java.sun.com/javame/downloads/sdk30ea.jsp"&gt;Java ME SDK&lt;/a&gt; as of version 3.0.&lt;/i&gt;
&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/rFoP3CBCO0c" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/asynchronous_communications_with_java_me1</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/working_with_bluetooth_and_gps</id>
        <title type="html">Bluetooth and GPS: Part 2 - Parsing GPS Data and Rendering a Map</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/_6gGz9R5JFE/working_with_bluetooth_and_gps" />
        <published>2008-10-27T19:13:23-07:00</published>
        <updated>2009-06-10T15:23:30-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="bluetooth" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <category term="msa" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;Bruce Hopkins describes how to use Java ME technology and its Bluetooth API (JSR-82)  to access location data from wireless GPS devices, in this second of a two-part series. The JSR-172 (XML Parsing and Web Services) API is used to parse the result.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;By Bruce Hopkins&lt;/p&gt;


&lt;p&gt;This article shows how easy it is to use the JSR-82 (Bluetooth) API to access the data from a Bluetooth-enabled GPS receiver, parse the data streams, and obtain the coordinates of current location. Additionally, you'll see how to formulate the HTTP request to access an external mapping service, use JSR-172 (XML Parsing and Web Services) API to parse the result, and make the final request to obtain the map image. Both JSR-82 and JSR-172 are included in the Java ME MSA standard.&lt;/p&gt;


&lt;p&gt;&lt;a href="http://developers.sun.com/mobility/apis/articles/bluetooth_gps/part2/"&gt;Read the full article.&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Also, see the &lt;a href="http://blogs.sun.com/mobility_techtips/entry/working_with_bluetooth_and_gps1"&gt;Follow Up&lt;/a&gt; to this series, where Bruce Hopkins answers questions from readers of this series.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/_6gGz9R5JFE" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/working_with_bluetooth_and_gps</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/blu_ray_disc_application_development</id>
        <title type="html">Blu-ray Disc Application Development with Java ME</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/tt5S1_2b3QA/blu_ray_disc_application_development" />
        <published>2008-09-16T11:51:35-07:00</published>
        <updated>2008-09-16T11:51:35-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="bd-j" scheme="http://roller.apache.org/ns/tags/" />
        <category term="blu-ray" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;Java technology is a critical part of the new high-definition video standard, the Blu-ray Disc standard. In this first of a two-part series, Bruce Hopkins covers several aspects of using the Java language to create applications for your Blu-ray disc player, which includes the very popular PlayStation 3 gaming console.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;By Bruce Hopkins&lt;/p&gt;


&lt;p&gt;The Java platform for Blue-ray disc players is called BD-J. In the first part of this series, I'm going to cover the following topics:&lt;/p&gt;


&lt;p&gt;    * Basic Requirements for BD-J Development&lt;br/&gt;
    * What the BD-J Platform Can Do&lt;br/&gt;
    * BD-J Specification and APIs&lt;br/&gt;
    * Understanding the Blu-ray Profiles&lt;br/&gt;
    * Xlets and Xlet Lifecycles&lt;br/&gt;
    * Creating Your First BD-J Application&lt;/p&gt;


&lt;p&gt;Included is sample code that creates a simple application that implements all the Xlet lifecycle methods. It performs a very simple operation: writing text on the screen.&lt;/p&gt;


&lt;p&gt;I'm going to assume that you have absolutely no Java ME or video-content creation experience whatsoever. Having that said, let's get started.&lt;/p&gt;


&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/javame/bluray/"&gt;Continue on to the full article&lt;/a&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/tt5S1_2b3QA" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/blu_ray_disc_application_development</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/using_javascript_object_notation_json</id>
        <title type="html">Using JavaScript Object Notation (JSON) in Java ME for Data Interchange</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/-TZUptgMf4I/using_javascript_object_notation_json" />
        <published>2008-09-04T20:19:09-07:00</published>
        <updated>2008-09-04T20:19:09-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javascript" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;In this code-rich article, mobility technologist C. Enrique Ortiz introduces the lightweight JSON  Java ME APIs as an alternative to XML.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;In mobile applications, developers typically rely on home-grown data-interchange formats or on the Extensible Markup Language (XML). The advantage of the former is that it can be tailored to particular situations for the purpose of maximizing performance and/or computational resources. The advantage of the latter, when used over HTTP, is that it is a de facto standard for data interchange. In addition, the text-based/human-readable representation used in XML makes it easier to debug.&lt;/p&gt;


&lt;p&gt;Yet these two approaches also have disadvantages, one being proprietary in nature, non-standard, and potentially non-interoperable, while the other one could be considered too heavy and verbose for data representation, again this is especially true for mobile and embedded applications. &lt;/p&gt;


&lt;p&gt;An alternative to consider is JSON, a lightweight data-interchange format. JSON is defined as part of JavaScript (ECMAScript) scripting language. Being native to JavaScript, JSON is ideal for browser-based applications. But JSON is not limited to JavaScript, and its lightweight characteristics make it very attractive for mobile and embedded applications in general.&lt;/p&gt;


&lt;p&gt;This article covers the following topics:&lt;/p&gt;


&lt;p&gt;- JSON-Supported Data Types&lt;br/&gt;
- JSON on Java ME&lt;br/&gt;
- Using JSON&lt;br/&gt;
- The Core JSON JSONObject Class  	&lt;br/&gt;
- The Example DataTypes Class&lt;br/&gt;
- Serializing to JSON: Generating JSON Text&lt;br/&gt;
- Deserializing JSON: Initializing the Class from JSON Text&lt;br/&gt;
- Using the Serialization Methods&lt;/p&gt;


&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/javame/json-me/"&gt;Read the full article&lt;/a&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/-TZUptgMf4I" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/using_javascript_object_notation_json</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/javafx_preview_sdk_q_a</id>
        <title type="html">JavaFX Preview SDK - "Experts" Q&amp;A</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/-zrIw5IDfk0/javafx_preview_sdk_q_a" />
        <published>2008-08-25T13:26:26-07:00</published>
        <updated>2008-08-25T13:26:26-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;During the week of August 18, 2008, we encouraged you to "Ask the Experts" your questions about the recent JavaFX Preview SDK release. Our experts were Joshua Marinacci, Martin Brehovsky, and Lawrence McDonough of the JavaFX engineering team, plus Jeff Dinkins. Here's a list of the question-and-answer topics.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;During the week of August 18, 2008, we encouraged you to "Ask the Experts" your questions about the recent JavaFX Preview SDK release. In this session, our experts were Joshua Marinacci, Martin Brehovsky, and Lawrence McDonough of the JavaFX engineering team. Jeff Dinkins, engineering manager for Java Graphics &amp; Media, also pitched in for one question.&lt;/p&gt;


&lt;p&gt;You can read a &lt;a href="http://java.sun.com/developer/community/askxprt/sessions/2008/jl0818.jsp"&gt;transcript of the session&lt;/a&gt;. The following topics are addressed:&lt;/p&gt;


&lt;p&gt;•	Using a node-based approach versus Swing component-based approach&lt;br/&gt;
•	Putting a layout component in a Frame object or a layout component&lt;br/&gt;
•	Getting different results when invoking static methods on a class&lt;br/&gt;
•	Deploying applets&lt;br/&gt;
•	Decreasing the Java installation time and size&lt;br/&gt;
•	Comparing Java Server Faces (JSF) and JavaFX&lt;br/&gt;
•	Working with Hibernate and Seam&lt;br/&gt;
•	Adding more components&lt;br/&gt;
•	Developing a web-mapping/tile-based server solution in JavaFX versus JavaScript&lt;br/&gt;
•	Working with the previous release's Eclipse plugin&lt;br/&gt;
•	Supporting the designer-developer workflow&lt;br/&gt;
•	Using multiple inheritance versus interfaces&lt;br/&gt;
•	Improving the sample applications&lt;br/&gt;
•	Communicating with applets dragged outside the browser&lt;br/&gt;
•	Using data binding with Java objects&lt;br/&gt;
•	Using traditional web technologies for javafx.com site&lt;br/&gt;
•	Installing JavaFX &lt;br/&gt;
•	Open-sourcing the JavaFX platform&lt;br/&gt;
•	Supporting javafx.ext.swing classes and multiline formatted text&lt;br/&gt;
•	Developing third-party components&lt;br/&gt;
•	Providing database-driven samples&lt;br/&gt;
•	Providing local persistence storage (or embedded database) &lt;br/&gt;
•	Building graphic assets for use in JavaFX&lt;br/&gt;
•	Using the Scene Graph UI&lt;br/&gt;
•	Persisting UI state and user data&lt;br/&gt;
•	Using transparent backgrounds&lt;br/&gt;
•	Needing more JavaFX documentation&lt;br/&gt;
•	Defining the tween keyword&lt;br/&gt;
•	Encoding/decoding video formats and audio types&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/-zrIw5IDfk0" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/javafx_preview_sdk_q_a</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/creating_a_custom_scrollable_table</id>
        <title type="html">Creating a Custom Scrollable Table with JavaFX</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/WgsnLX01EVw/creating_a_custom_scrollable_table" />
        <published>2008-08-19T15:04:28-07:00</published>
        <updated>2008-08-19T15:04:28-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;JavaFX expert Jim Weaver continues his series of articles with this latest one, &lt;a href="http://learnjavafx.typepad.com/weblog/2008/08/tablenode-creat.html"&gt;TableNode: Creating a Custom Scrollable Table in JavaFX&lt;/a&gt;.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;JavaFX expert Jim Weaver continues his series of articles with this latest one, &lt;a href="http://learnjavafx.typepad.com/weblog/2008/08/tablenode-creat.html"&gt;TableNode: Creating a Custom Scrollable Table in JavaFX&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;In this collaborative series,  he works with graphics designer Mark Dingman of Malden Labs on an imaginary Sound Beans application. The objectives are to show how to create custom UI controls in JavaFX, and to provide a case study in how a graphics designer and an application developer can work together effectively in developing JavaFX applications. Each &lt;br/&gt;
article contains the source code and Java Web Start to run the application.&lt;/p&gt;


&lt;p&gt;Read the &lt;a href="http://JavaFXpert.com/weblog/jfx_custom_nodes/index.html"&gt;article series&lt;/a&gt;   in his JavaFXpert.com blog.  &lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/WgsnLX01EVw" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/creating_a_custom_scrollable_table</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/ask_the_experts_java_fx</id>
        <title type="html">Ask the Experts: JavaFX Preview, August 18-22</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/0ov8yx2Zm9k/ask_the_experts_java_fx" />
        <published>2008-08-07T16:57:00-07:00</published>
        <updated>2008-08-07T17:09:09-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;The recently released JavaFX Preview helps early adopters become familiar with JavaFX. Got a question about it? &lt;a href="http://java.sun.com/developer/community/askxprt/"&gt;Post it during this session&lt;/a&gt; and get answers from three key members of Sun's JavaFX engineering team.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;The &lt;a href="http://java.sun.com/javafx/"&gt;JavaFX&lt;/a&gt; family of products includes the tools and platform SDK that developers, web scripters, and designers need to create dynamic applications for the next generation of web-delivered content. Sun recently released a &lt;a href="http://java.sun.com/javafx/downloads/"&gt;JavaFX Preview&lt;/a&gt; designed to help early adopters become familiar with JavaFX.&lt;/p&gt;


&lt;p&gt;If you have a question about the JavaFX Preview, &lt;a href="http://java.sun.com/developer/community/askxprt/"&gt;&lt;b&gt;post your questions&lt;/b&gt;&lt;/a&gt; during this session and get answers from three key members of Sun's JavaFX engineering team: Josh Marinacci, Martin Brehovsky, and Larry McDonough.&lt;/p&gt;


&lt;p&gt;Typically, a one week period is designated for questions on a specific Ask the Experts topic. You can submit a question on that topic any time during that week. We'll collect the questions periodically and send them to the experts. We'll then post a selected set of questions and answers. Although the experts will try to answer as many questions as feasible, there is no guarantee that all questions will be answered.&lt;/p&gt;


&lt;p&gt;Get more information at the &lt;a href="http://java.sun.com/developer/community/askxprt/"&gt;Ask The Experts website&lt;/a&gt;.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/0ov8yx2Zm9k" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/ask_the_experts_java_fx</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/javafx_learning_curve_journal_updates</id>
        <title type="html">JavaFX Learning Curve Journal Updates</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/nmYjuNyq3wQ/javafx_learning_curve_journal_updates" />
        <published>2008-07-31T10:16:28-07:00</published>
        <updated>2008-09-09T11:11:34-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;In August and September 2007, the Sun Developer Network staff started a Learning Curve Journal, a series designed to help users get started with the JavaFX Script programming language. A number of significant advances have been made to the language since then. The Learning Curve Journal has been updated to show you how to use the compiler-based version of the language. Other changes have been made to make the articles current.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;In August and September 2007, the Sun Developer Network staff started a Learning Curve Journal, a series designed to help users get started with the JavaFX Script programming language (shortened to JavaFX Script hereafter). A number of significant advances have been made to the language since then. Perhaps most important is the availability of a compiler-based version of JavaFX Script, which replaces the earlier interpreter-based version of the language. The Learning Curve Journal described the use of the interpreter-based version of the language. The Learning Curve Journal has been updated to show you how to use the compiler-based version of the language. Other changes have been made to make the articles current.&lt;/p&gt;


&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/scripting/javafx/lc/part1/"&gt;&lt;b&gt;Part 1: Exploring JavaFX Script&lt;/b&gt;&lt;/a&gt; gets you started with a simple JavaFX program, that is, a simple program written in the JavaFX Script language. You'll learn how to set up your environment for programming in JavaFX Script and how to build and run a JavaFX program. &lt;/p&gt;


&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/scripting/javafx/lc/part2/"&gt;&lt;b&gt;Part 2: Declarative User Interfaces&lt;/b&gt;&lt;/a&gt; focuses on the declarative style of coding enabled by JavaFX Script. You'll see how this style can make the code for a graphical application simpler and more intuitive. &lt;/p&gt;


&lt;p&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/scripting/javafx/lc/part3/"&gt;&lt;b&gt;Part 3: JavaFX Script Functions&lt;/b&gt;&lt;/a&gt; shows you how to use JavaFX Script functions to implement actions in a Java FX program.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/nmYjuNyq3wQ" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/javafx_learning_curve_journal_updates</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/bluetooth_and_gps_part_1</id>
        <title type="html">Bluetooth and GPS: Part 1 - Reading Wireless Serial Port Data</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/9lA_UzzTGYo/bluetooth_and_gps_part_1" />
        <published>2008-07-16T15:26:29-07:00</published>
        <updated>2009-06-10T15:23:46-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="bluetooth" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jsr-82" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;In the first of this multi-part series, Bruce Hopkins describes how to construct a low-cost solution that allows you to install, debug, and test your JSR-82 applications on your computer, and how to read data from a Bluetooth-enabled GPS device.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;For some developers, working with wireless technologies can be daunting -- and sometimes downright intimidating. When communication is wireless, you can't just "look up" and see, for instance, 1 MB of data going by. In addition, it is really difficult to debug wireless applications once they are deployed to a mobile device, since you don't have access to system traces or log files to pinpoint the errors while the application is running.&lt;/p&gt;


&lt;p&gt;This technical article addresses the following tasks:&lt;/p&gt;


&lt;p&gt;    * Helps demystify some wireless concepts using Bluetooth and the JSR-82 API&lt;br/&gt;
    * Shows how to run and debug Java ME Bluetooth applications on your desktop computer&lt;br/&gt;
    * Explains how to read data from a Bluetooth-enabled GPS device&lt;/p&gt;


&lt;p&gt;The good news is that you're going to learn how to construct a low-cost solution that allows you to install, debug, and test your JSR-82 applications on your computer. I'm going to introduce to you the Mpowerplayer, a CLDC emulator for the computer that can be configured to behave like a JSR-82 Bluetooth-enabled phone. With this configuration, the Mpowerplayer will behave just like a JSR-82 Bluetooth-enabled mobile phone, but you'll have access to the System.out and have the ability to view stacktraces, both of which are essential in debugging your wireless application.&lt;/p&gt;


&lt;p&gt;Read the &lt;a href="http://developers.sun.com/mobility/apis/articles/bluetooth_gps/part1/"&gt;full article&lt;/a&gt; and download the &lt;a href="http://developers.sun.com/mobility/apis/articles/bluetooth_gps/part1/BluetoothGPSMidlet.java"&gt;source code&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;Also, see the &lt;a href="http://blogs.sun.com/mobility_techtips/entry/working_with_bluetooth_and_gps1"&gt;Follow Up&lt;/a&gt; to this series, where Bruce Hopkins answers questions from readers of this series.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/9lA_UzzTGYo" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/bluetooth_and_gps_part_1</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/digisoft_tv_s_john_allen</id>
        <title type="html">Digisoft.tv's John Allen on Interactive Television</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/62mdhhr07fI/digisoft_tv_s_john_allen" />
        <published>2008-07-15T16:31:01-07:00</published>
        <updated>2008-07-15T16:31:01-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="applications" scheme="http://roller.apache.org/ns/tags/" />
        <category term="client" scheme="http://roller.apache.org/ns/tags/" />
        <category term="internet" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="me" scheme="http://roller.apache.org/ns/tags/" />
        <category term="media" scheme="http://roller.apache.org/ns/tags/" />
        <category term="rich" scheme="http://roller.apache.org/ns/tags/" />
        <category term="tv" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;Sun's Jennifer Yonemitsu interviews Digisoft.tv CEO John Allen to discuss the Java ME-based client platform for IPTV set-top boxes, using Sun's Java technology-based media client and Digisoft.tv's middleware/SDK.&lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;Sun Microsystems and DigiSoft.tv have each explored using Java technology to address the challenges related to content development for the IP-based interactive TV market. Developers face tough challenges writing and deploying applications for existing proprietary middleware platforms.&lt;/p&gt;


&lt;p&gt;To address these developer challenges, Sun and DigiSoft worked together and, in April 2008, announced the general availability of a Java Platform, Micro Edition (Java ME) based client platform for IPTV set-top boxes (STBs). This client solution incorporates Sun's Java technology-based media client and Digisoft.tv's middleware/SDK. This combined solution is suitable for IP-based media receivers.&lt;/p&gt;


&lt;p&gt;Sun's Sr. Product Line Manager for digital media, Jennifer Yonemitsu, recently sat down with Digisoft.tv CEO John Allen to discuss this joint solution.&lt;/p&gt;


&lt;p&gt;Read the &lt;a href="http://java.sun.com/developer/technicalArticles/javame/iptv-digisoft/"&gt;full interview&lt;/a&gt;.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/62mdhhr07fI" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/digisoft_tv_s_john_allen</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/near_field_communication_and_the</id>
        <title type="html">Near-Field Communication and the Contactless Communication API (JSR 257)</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/OPECdqvW7cI/near_field_communication_and_the" />
        <published>2008-06-19T17:22:42-07:00</published>
        <updated>2008-06-19T17:22:42-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="javame" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mobility" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">
&lt;p&gt;NFC is a short-range radio technology that operates on the 13.56 MHz frequency, with data transfers of up to 424 kilobits per second. NFC communication is triggered when two NFC-compatible devices are brought within close proximity, around four centimeters. The Contactless Communication API allows you to discover and exchange data with contactless targets such as NDEF tags, RFID tags, and external smartcards. C. Enrique Ortiz dissects a Contactless Communication API MIDlet. &lt;/p&gt;

</summary>
        <content type="html">
&lt;p&gt;By C. Enrique Ortiz&lt;/p&gt;


&lt;p&gt;Near-field Communication (NFC) is characterized as a very short-range radio communication technology with a lot of potential, especially when applied to mobile handsets. Imagine yourself using your cellphone to interact with posters, magazines, and even with products while at the store, and with such interaction initiating a request or search for related information in real-time. Other usages of NFC include the electronic wallet to make payments using your handset, the same way you do with your credit card. With NFC all this is possible. But NFC is still a young technology. That said, NFC-enabled handsets are being introduced into the market, and deployments and pilots around the world are occurring. This article explores NFC and how you can leverage it in your Java application by using the Contactless Communications API. &lt;a href="http://java.sun.com/developer/technicalArticles/javame/nfc/"&gt;Read the full article.&lt;/a&gt;&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/OPECdqvW7cI" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/near_field_communication_and_the</feedburner:origLink></entry>
    <entry>
        <id>http://blogs.sun.com/mobility_techtips/entry/the_bluetooth_conundrum</id>
        <title type="html">The Bluetooth Conundrum</title>
        <author><name>Christine Dorffi</name></author>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/mobilitytechtips/~3/yDIX-HQR3vE/the_bluetooth_conundrum" />
        <published>2008-06-02T13:03:04-07:00</published>
        <updated>2008-06-02T13:03:04-07:00</updated> 
        <category term="/Mobility" label="Mobility" />
        <category term="82" scheme="http://roller.apache.org/ns/tags/" />
        <category term="apis" scheme="http://roller.apache.org/ns/tags/" />
        <category term="bluetooth" scheme="http://roller.apache.org/ns/tags/" />
        <category term="detection" scheme="http://roller.apache.org/ns/tags/" />
        <category term="j2me" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javax.microedition.bluetooth" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jsr" scheme="http://roller.apache.org/ns/tags/" />
        <category term="me" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">SDN staff writer Richard Marejka provides the required code to programmatically detect the presence of the JSR 82 Bluetooth APIs.
</summary>
        <content type="html">&lt;p&gt;By &lt;a href="http://java.sun.com/features/authors.html#marejka"&gt;Richard Marejka&lt;/a&gt;

&lt;p&gt;&lt;b&gt;Question:&lt;/b&gt; How do you programmatically detect the presence of the &lt;a href="http://java.sun.com/javame/technology/msa/jsr82.jsp"&gt;JSR 82 Bluetooth APIs&lt;/a&gt;?

&lt;p&gt;&lt;b&gt;Answer:&lt;/b&gt; It would be nice if the answer were this:

&lt;pre&gt;
import	javax.microedition.*;
import	javax.bluetooth.*;

...

String	BluetoothVersion = System.getProperty( "bluetooth.api.version" );
boolean	isBluetoothHere  = false;

...

if ( BluetoothVersion != null )
	isBluetoothHere = true;
&lt;/pre&gt;

&lt;p&gt;On a Bluetooth v1.0 device, the previous code will always result in:

&lt;pre&gt;
BluetoothVersion = null;
isBluetoothHere  = false;
&lt;/pre&gt;

&lt;p&gt;that is, a negative or a false negative detection of Bluetooth.

&lt;p&gt;The reason it is not as simple as the first code sample lies in the first version of JSR 82 Bluetooth APIs. In the original Bluetooth specification, JSR 82 v1.0a (Apr 5, 2002), section 3.3.4 Device Properties states: "This API defines the additional system properties that may be retrieved by a call to &lt;code&gt;LocalDevice.getProperty()&lt;/code&gt;, as shown in Table 3-2."

&lt;p&gt;The table in question contains a &lt;code&gt;bluetooth.api.version&lt;/code&gt; property that will return &lt;code&gt;1.0&lt;/code&gt; if Bluetooth is supported. To correctly discover Bluetooth on a v1.0 device, the required code follows:

&lt;pre&gt;
import	javax.bluetooth.*;

...

String	BluetoothVersion = null;
boolean	isBluetoothHere  = true;

...

try {
	Class.forName( "javax.bluetooth.LocalDevice" );    // does the class exist?

	BluetoothVersion = javax.bluetooth.LocalDevice.getProperty( "bluetooth.api.version" );

} catch( ClassNotFoundException cnf ) {    // class does not exist -&gt; no Bluetooth
	isBluetoothHere  = false;
}
&lt;/pre&gt;

&lt;p&gt;Access to &lt;code&gt;javax.bluetooth.LocalDevice&lt;/code&gt; is required to determine if Bluetooth is present. The &lt;code&gt;Class.forName()&lt;/code&gt; method is used to test for the presence of a class in the run-time environment. If the class is found, then &lt;code&gt;LocalDevice&lt;/code&gt; can be safely accessed to retrieve the Bluetooth version.

&lt;p&gt;This somewhat non-intuitive detection method was changed in JSR 82 v1.1 (Sep 02, 2006, Maintenance Release 2). Section 3.3.4 has been revised to include the sentence: "Additionally, all properties defined in the Bluetooth API and available through the &lt;code&gt;LocalDevice.getProperty&lt;/code&gt; method MUST also be available through the CLDC &lt;code&gt;System.getProperty()&lt;/code&gt; method."

&lt;p&gt;The same section also defines the property/value pairs in Table 3-2:

&lt;pre&gt;
bluetooth.api.version  "1.1"
obex.api.version       "1.1"
&lt;/pre&gt;

&lt;p&gt;which means the &lt;code&gt;System.getProperty()&lt;/code&gt; method will work as expected.

&lt;p&gt;As for &lt;a href="http://java.sun.com/javame/technology/msa/"&gt;JSR 248 MSA&lt;/a&gt;: Bluetooth is conditionally mandatory; that is, if there is Bluetooth hardware then the JSR 82 APIs are present. Bluetooth v1.1 is part of both MSA and MSA Subset.

&lt;p&gt;Lastly, note that the first code sample will still work and produce the correct answer on both Bluetooth 1.0 and 1.1 devices. In cases where there is no Bluetooth, the result is:

&lt;pre&gt;
isBluetoothHere  = false;
BluetoothVersion = null;
&lt;/pre&gt;

&lt;p&gt;or if Bluetooth is present, the result is either

&lt;pre&gt;
isBluetoothHere  = true;
BluetoothVersion = "1.0";
&lt;/pre&gt;

&lt;p&gt;or

&lt;pre&gt;
isBluetoothHere  = true;
BluetoothVersion = "1.1";
&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/mobilitytechtips/~4/yDIX-HQR3vE" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://blogs.sun.com/mobility_techtips/entry/the_bluetooth_conundrum</feedburner:origLink></entry>
</feed>
