Opening a sensor connection

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

A sensor connection is opened with the javax.microedition.io.Connector.open() method with the sensor URL is given as a parameter, such as in the following 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. For example, on the Symbian platform the URL sensor:acceleration matches two different versions of the accelerometer: one providing double values presented in m/s^2 and another providing raw integer values from the sensor.