Open a Wi-Fi HTTP connection

The interface=wifi parameter applies only to TCP/UDP connections. To establish a Wi-Fi® connection and use a Wi-Fi API in a BlackBerry® device application, the wireless service provider must support Wi-Fi access.

  1. Import the following classes:
    • java.lang.String
    • javax.microedition.io.Connector
  2. Import the javax.microedition.io.HttpConnection interface.
  3. Invoke Connector.open(), specify http as the protocol, and append the interface=wifi parameter to the end of the URL string value.
  4. Cast the returned object as an HttpConnection or a StreamConnection object.
    HttpConnection conn = null;
    String URL = "http://www.myServer.com/myContent;deviceside=true;interface=wifi";
    conn = (HttpConnection)Connector.open(URL);

Index


Was this information helpful? Send us your comments.