Adding sensor configurations to your Ultrabook and Tablet app

Windows 8 devices are certainly showing variety today. New convertible Ultrabooks and Intel tablets have screens that fold over, slide out or detach from the keyboard.  When you build an app, and send out to the market, you don't know if the user has one of these new devices, what type and or what position the screen is to the base.  This could create a usability issue if you created an app that leverages the motion sensors.

In this video I explain an issue I realized when testing my app from an Ultrabook to a Tablet.  It did not occur to me how someone holds and moves these devices will change on the device in hand, the size of the device and the comfort of the user to move the device.  Because of this I created a sensor configuration feature in my app.  I highly suggest you consider some version of this if you are using sensors in your application. While there may be more automated triggers, I believe giving the user control to configure the experience will improve the experience.

One example I discuss in the video is allowing for a user to configure a neutral angle for holding the device. To add this feature I simply added a variable called "holdAngle" to the event listener function to off set the data coming in from the sensor.  For example if the device is naturally held at 30 degrees then I adjusted the "inclX" input by 30 degrees.  That way if held the device at 30 degrees the app adjusts that to be the still or neutral angle of the device. For my app I've allowed the user to choose between 6 different settings.  How you do this is up to you. 

var holdAngle = -30;

if (webapp == false) {

    inclinometer = Windows.Devices.Sensors.Inclinometer.getDefault();

    inclinometer.addEventListener("readingchanged", onIncReadingChanged);

    gyrometer = Windows.Devices.Sensors.Gyrometer.getDefault();

    gyrometer.addEventListener("readingchanged", onGyroReadingChanged);



function onIncReadingChanged(e) {

    var inclX = e.reading.pitchDegrees;

    var inclY = e.reading.rollDegrees;

    var inclZ = e.reading.yawDegrees;

    xAngle = inclY;

    yAngle = inclX + holdAngle;


If you have more thoughts on how sensors can be configured based upon form factor or user preference, let us know your thoughts..

More posts in this series.