1 / 41

Using location & sensors in your app

PLAT-781T. Using location & sensors in your app. Gavin Gear Program Manager Microsoft Corporation. Agenda. Location and sensor experiences Building location-aware apps Everyday sensor apps Sensor fusion in Windows 8 You’ll leave with examples of how to

callie
Download Presentation

Using location & sensors in your app

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PLAT-781T Using location & sensors in your app Gavin Gear Program Manager Microsoft Corporation

  2. Agenda • Location and sensor experiences • Building location-aware apps • Everyday sensor apps • Sensor fusion in Windows 8 You’ll leave with examples of how to • Effectively use location and sensors in your apps • Innovate with the latest sensor technology

  3. Windows 8 empowers you to build apps that can seamlessly adapt to your customer’s environment using sensors and location.

  4. With sensors & location platform • Simple interfaces enable Metro style apps to adapt to the surrounding environment • Sensor fusion opens up new possibilities for creating cutting edge experiences in Metro style apps • Windows 8 provides a consistent sensors and location hardware foundation • Windows 8 ensures consistency between different systems to ensure that apps just work

  5. Windows 8 supports the latest sensors • Tablet and convertible standard equipment: • Ambient Light Sensor • Motion Sensor Fusion(Accelerometer, Magnetometer, Gyroscope) • Windows Location Provider • GPS (If mobile broadband hardware is present)

  6. Building location-aware apps

  7. demo NearMe Location-Aware App

  8. The world is a big place. Your app can help make it smaller.

  9. Single-shot location scenarios • Search points of interest (POI) • Geo-tag photos and other content • Basic mapping application • Local info apps (weather, news, sports, …) • Social networking check-in

  10. Event-based location scenarios • Navigation • Real-time location-aware notifications • Location-aware tasks • Virtual tour guide • Local ads/coupons • Auto checkout (social networking)

  11. Declare the need for Geolocation • // Application manifest capabilities required • // to access Geolocation & Camera in your app • <Capabilities> •     <DeviceCapability Name="webcam" /> • <DeviceCapabilityName=“location" /> • </Capabilities>

  12. Location-based user experience

  13. GeoLocation – Single-Shot • varloc; • loc = new Windows.Devices.Geolocation.Geolocator(); • loc.getGeopositionAsync().then(getPositionHandler); • function getPositionHandler(pos) { • varlat = pos.coordinate.latitude; • var long = pos.coordinate.longitude; • varacc = pos.coordinate.accuracy; • }

  14. GeoLocation – Event-Based • varloc; • loc = new Windows.Devices.Geolocation.Geolocator(); • loc.addEventListener("positionchanged", onPositionChanged); • function onPositionChanged(args) { • varpos = args.position; • varlat = pos.coordinate.latitude; • var long = pos.coordinate.longitude; • varacc = pos.coordinate.accuracy; • }

  15. W3C API and Windows API comparison • Metro style apps can use W3C or Windows Runtime • Differences: • W3C: maximum age • Windows: movement threshold, status • Windows supports multiple languages • JavaScript, C++, C# • W3C – JavaScript only

  16. Everyday sensor apps

  17. demo Labyrinth game demo

  18. Most apps can benefit from sensors.

  19. Basic app scenarios for sensors Shake Rotate Flip

  20. Light-aware apps – render for lighting Dark Indoors Outdoors

  21. Intermediate motion sensor scenarios • Casual games • Labyrinth: Accelerometer • Gyro for twisting response

  22. Windows.Devices.Sensors Namespace Simple Data Simple Device Orientation Raw Sensor Data Light Sensor Accelerometer Gyro Sensor Fusion Data Compass Inclinometer Device Orientation

  23. Accelerometer Sample Code • var accelerometer; • accelerometer = Windows.Devices.Sensors.Accelerometer.getDefault(); • accelerometer.addEventListener("readingchanged",onAccReadingChanged); • function onAccReadingChanged(e) { • varaccelX = e.reading.accelerationX; • varaccelY = e.reading.accelerationY; • varaccelZ = e.reading.accelerationZ; • }

  24. video Microsoft interns using sensors in their apps

  25. Sensor Fusion

  26. demo Metro steering wheelSimple3DApp

  27. The whole is greater than the sum of the parts.

  28. What is Sensor Fusion? The process of using multiple sensor inputs to enhance or synthesize sensor outputs.

  29. Sensor Fusion inputs and outputs (9-Axis) Accelerometer 3D Accelerometer Pass-Through 3D Gyro Gyro 3D Magnetometer Sensor Fusion Compass Inclinometer Device Orientation

  30. Sensor Fusion app scenarios • Inclinometer: • Steering wheel input for game • Device Orientation: • Augmented reality control • First person style games

  31. Device orientation - quaternion α x, y, z α Y+ Z+ Vector Rotation = X+

  32. Device orientation – using quaternion Quaternion DirectX Math DirectX Object Apply to Environment Transform Data Sensor Data

  33. Inclinometer Code – Rotating an Element • inclinometer = Windows.Devices.Sensors.Inclinometer.getDefault(); • inclinometer.reportInterval = 50; • reading = inclinometer.getCurrentReading(); • initialYaw = reading.yawDegrees; • inclinometer.addEventListener("readingchanged",onInclReadingChanged); • function onInclReadingChanged(e) { • vardeltaAngle = initialYaw– e.reading.yawDegrees; • varel = document.getElementById("el"); • el.style.msTransform= "rotate(" + deltaAngle.toFixed(4) + "deg)"; • }

  34. Recap

  35. Windows 8 empowers you to build apps that can seamlessly adapt to your customers environment using sensors and location.

  36. With sensors & location platform • Simple interfaces enable Metro style apps to adapt to the surrounding environment • Sensor fusion opens up new possibilities for creating cutting edge experiences in Metro style apps • Windows 8 provides a consistent sensors and location hardware foundation • Windows 8 ensures consistency between different systems to ensure that apps just work

  37. Related sessions • [HW-774T] Building great Windows 8 systems • [HW-249T] Architecting and integrating sensor drivers • [PLAT-754T] From touch to gamepads: master player input in your Metro style game

  38. Further reading and documentation • Whitepapers: • Detecting geolocation • Responding to motion & orientationsensors • Responding to light • Guidelines and checklist for sensors • Introduction to Background Tasks (Location) • Contact info: Location – locext@microsoft.com • Contact info: Sensors – sensext@microsoft.com

  39. thank you Feedback and questions http://forums.dev.windows.com Session feedbackhttp://bldw.in/SessionFeedback

  40. © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related