Opening a sensor connection

After finding the correct SensorInfo object, you can determine the sensor URL with the SensorInfo.getUrl method.

To open a sensor connection, use the javax.microedition.io.Connector.open method with the sensor URL as a parameter, for example:

SensorConnection sensorConnection;
try {
    sensorConnection = (SensorConnection)Connector.open(sensorInfo.getUrl());
} catch (IOException e) {
    // Handle Exception if Connector.open() fails
}

The sensor connection can be opened directly without using findSensors when the sensor URL is known. For maximum compatibility between different devices and implementations, try to select the sensor as precisely as possible.