Code example for SensorManager

Methods: getDefaultSensor

0
    	// get the SensorManager from the Activity 
    	sensorManager = (SensorManager) CCDirector.sharedDirector().getActivity().getSystemService(Context.SENSOR_SERVICE);
    	 
    	// if we have a SensorManager then get the accelerometer Sensor 
    	if (sensorManager != null) 
    		accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    	else 
    		accelerometer = null;
    	 
        CGSize s = CCDirector.sharedDirector().winSize();
        setRelativeAnchorPoint(false); 
 
        setAnchorPoint(CGPoint.make(0.5f, 0.5f)); 
        setContentSize(s);
        setRelativeAnchorPoint(false); 
 
        isTouchEnabled_ = false;
        isAccelerometerEnabled_ = false;
    } 
 
    /**