Your SlideShare is downloading. ×
0
×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Location and API Maps in Windows Phone 8

1,053

Published on

Location and API Maps in Windows Phone 8 (special guest nokia here launchers) …

Location and API Maps in Windows Phone 8 (special guest nokia here launchers)
slides for Windows Phone Day Catania November 2013

Published in: Business, Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,053
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Windows Phone Day November 2013 - Catania LOCATION AND MAPS API IN WINDOWS PHONE 8 SPECIAL GUESTS: THE NOKIA HERE® LAUNCHERS Ing. Antonio Pelleriti Chief Software Architect @ Dynamicode follow me: @zetanove www.antoniopelleriti.it
  • 2. GRAZIE © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 3. AGENDA • • • • • • • Geo Location Background tracking Map control Offline maps Geocoding/Reverse geocoding Route calculation and display Nokia HERE Launchers © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 4. GEOLOCATION © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 5. • • A-GPS Wi-Fi triangulation Cell Tower triangulation © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved. Power consumptiom • accuracy GEO LOCATION SENSING TECHNOLOGIES
  • 6. GEOLOCATION ARCHITECTURE Managed layer: Provides .NET API (Pinvoke not allowed in Windows Phone) Native layer: Communicates with hw layer to determine location of device Hardware layer: Provides location information © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved. Managed Code Native Layer GPS WIFI Cellular networks
  • 7. LOCATION API To enable location features: add ID_CAP_LOCATION in WMAppManifest.xml Certification Requirement: check for user consent to using location api • • • In Windows phone 7: GeoCoordinateWatcher  now deprecated In Windows phone 8: Geolocator Obtain one shot position: • • Geoposition GetGeopositionAsync Continuous location tracking • event PositionChanged • • DesiredAccuracy, DesiredAccuracyInMeters, MovementThreshold event StatusChanged • Disabled, Initializing, NoData, NotAvailable, NotInitialized, Ready © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 8. BACKGROUND TRACKING (1/2) Setting app for background tracking • WMAppManifest.xml <DefaultTask Name="_default" NavigationPage="MainPage.xaml"> <BackgroundExecution> <ExecutionType Name="LocationTracking" /> </BackgroundExecution> </DefaultTask> • App.xaml <shell:PhoneApplicationService … Activated="Application_Activated" RunningInBackground="Application_RunningInBackground"/> © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 9. BACKGROUND TRACKING (2/2) Setting app for background tracking • App.xaml.cs private void Application_RunningInBackground(object sender, RunningInBackgroundEventArgs args) { RunningInBackground = true; // Suspend all unnecessary processing such as UI updates } private void Application_Activated (object sender, ActivatedEventArgs args) { RunningInBackground = false; } © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 10. TESTING GEOLOCATION WITH EMULATOR © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 11. GEOLOCATION DEMO © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 12. MAP CONTROL © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 13. MAP CONTROL • • Bing map control now deprecated (only for upgrading) Map Control • • • • • • Content: markers, overlays, polylines, polygons, route Settings: color, map type, pedestrian, landmarks, heading, pitch, zoom Features: geocoding, reverse geocoding, routing Capability ID_CAP_MAP in WMAppManifest.xml Reference: Microsoft.Phone.Maps.Controls Obtain API Keys from Dev Center © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 14. MAPS API KEY © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 15. SET MAPS API KEY Set the ApplicationID and AuthenticationToken private void map_Loaded(object sender, RoutedEventArgs e) { MapsSettings.ApplicationContext.ApplicationId = "id"; MapsSettings.ApplicationContext.AuthenticationToken = "token"; } © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 16. MAP CONTROL MEMBERS • • • • • GeoCoordinate Center (GeoCoordinate !=Windows.Devices.Geolocation.Geocoordinate) ZoomLevel (1..20) LandmarksEnabled PedestrianFeaturesEnabled CartographicMode • • ColorMap • • • • Road, Aerial, Hybrid, Terrain Light/Dark Heading (0-360) Pitch (0-75) SetView and animations in C# • MyMap.SetView(MyCoordinate, 16, MapAnimationKind.Parabolic); © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 17. MAPS BUILT-IN TASKS Maps task Launches the built-in Maps app and optionally marks a location. Maps directions task Launches the built-in Maps app and displays directions. MapDownloader task Downloads maps for offline use. MapDownloaderTask mapDownloaderTask = new MapDownloaderTask(); mapDownloaderTask.Show(); MapUpdater task Checks for updates for offline maps that the user has previously downloaded © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 18. MAP OVERLAY MapOverlay overlay = new MapOverlay { GeoCoordinate = myMap.Center, Content = new Ellipse { Fill = new SolidColorBrush(Colors.Red), Width = 40, Height = 40 } }; MapLayer layer = new MapLayer(); layer.Add(overlay); myMap.Layers.Add(layer); © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 19. GEOCODING/ROUTE CALCULATION • GeocodeQuery: converts a street address or place to a GeoCoordinate • RouteQuery: finds the shortest path between two GeoCoordinate, with any number of waypoints in between and using a TravelMode (walking, driving) • ReverseGeocodeQuery: obtains address or place informations from a GeoCoordinate: Continent, country, state, province, city, address, housenumber, building, postalcode, … © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 20. MAP DEMO © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 21. HERE APPLICATIONS © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 22. NOKIA HERE APPLICATIONS • • • • HERE Maps HERE Drive HERE Transit HERE City Lens They works together and with launchers you can use their features in your code! © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 23. HERE LAUNCHERS API © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 24. HERE LAUNCHERS The services provided by the HERE applications can be used in two ways: • HERE Launchers API (Tasks) • • https://github.com/nokia-developer/here-launchers Uri Schemes implemented in HERE applications. © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 25. HERE LAUNCHERS API Launch HERE Maps to: Launch HERE Drive to: Launch HERE Transit to: •Show route from user's current location (default) or selected origin to a destination. •Search for places with a text string. •Explore places by categories. •Show map of a selected location with desired zoom level. •Show place by ID or location on a map. •Provide drive guidance from user's current location to a specific destination. •Show journeys from user's current location (default) or selected origin to a destination, either using current time for departure (default) or with desired departure or arrival times. using Nokia.Phone.HereLaunchers; … DirectionsRouteDestinationTask routeTo = new DirectionsRouteDestinationTask(); routeTo.Destination = new GeoCoordinate(60.35, 24.60); routeTo.Mode = RouteMode.Car; routeTo.Show(); © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 26. URI SCHEME PROTOCOL FOR HERE APPS Currently 5 URI schemes. directions : for routing paths. explore-maps : for exploring map and map services. guidance-drive : for drive navigation. guidance-walk : for walk navigation. places : for showing places. public-transit : for public transit related use cases. Example: directions://v2.0/route/destination/?latlon=60.35,24.60&mode=car © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 27. HERE LAUNCHERS PROJECTS http://developer.nokia.com/Resources/Library /Lumia/#!maps-and-navigation/herelaunchers.html https://github.com/nokia-developer/here-launchers © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 28. Grazie! © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.

×