locked
SimpleOrientationSensor returning null

    Question

  • I'm using SimpleOrientationSensor to get the screen orientation information in my application. I'm testing this application in Windows Simulator but I always get the sensor object's value as null.

    This is what I'm doing

    SimpleOrientationSensor sensor;
    
    sensor = SimpleOrientationSensor.GetDefault();
    if (sensor != null)
    {
         sensor.OrientationChanged += sensor_OrientationChanged;
    }
    

    I understand that SimpleOrientationSensor.GetDefault() will return null when there is no Sensor available. Should I tweak the Simulator to get the sensor information? Or does it even handle these changes?

    Friday, October 12, 2012 6:59 AM

Answers

  • Hello

    You can't do that if your device doesn’t have Sensor because you use Simulator of your current device, not Emulator.

    So, you could do simulation on remote device that have orientation sensor. If you have another device with this sensor, you could do remote debugging to remote secondary device to test functionalities such as touch, geo-location, and physical orientation.

    First install Remote Debugging Tools and then connect to it.

    You have whole explanation on MSDN.

    Hope this help


    Spaso Lazarevic


    Sunday, November 04, 2012 11:28 AM