Header Sep
Java Tips, Tricks & Code
My Rating Score
Login to rate page

October 2004
Easy web browsing without GPRS

[Back]

Did you know it's possible to browse your local web server without using GPRS? This feature can be very useful, and save money, when developing MIDlets that should communicate with web applications. Plus, it's easy to do.

The source code in the MIDlet doesn't need that much editing; just make sure you direct your HTTP connection to your localhost, like:

HttpConnection hc = (HttpConnection)Connector.open(http://localhost/");

The connection to your computer is managed through the Connection Proxy that comes with the Sony Ericsson J2ME SDK. It allows connections to be made though serial, infrared or Bluetooth interfaces.

The first step after the MIDlet is created is to start the Sony Ericsson Device Explorer that's installed as part of the Sony Ericsson J2ME SDK (Start | Programs > Sony Ericsson > J2ME SDK > Device Explorer). The Device Explorer will automatically start the Connection Proxy and use that to connect to any phone found on the specified COM port, or using IR. If the Connection Proxy can't connect to the device, try to lower the connection speed or change the connecting port in the settings dialog.

The Device Explorer must also be configured to use "Serial Networking". This can be set in the File menu. You may have to restart the Device Explorer after check marking the Serial Networking… choice.

Now use the Device Explorer to install your MIDlet, File | > Install….When the MIDlet is installed on the device, it will be visible in the Device Explorer. Right-click the MIDlet and select Start. Now you should be able to connect your MIDlet to your local webserver, i.e. Internet Information Service or Apache.

If a MIDlet connects to the Internet using WAP/GPRS, a globe will be visible in the top of the phone's display. This globe won't be visible when you connect to your localhost using Device Explorer.

    

My Rating Score
Login to rate page