• Save
 

Location and API Maps in Windows Phone 8

on

  • 1,054 views

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

Statistics

Views

Total Views
1,054
Views on SlideShare
1,054
Embed Views
0

Actions

Likes
2
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Location and API Maps in Windows Phone 8 Location and API Maps in Windows Phone 8 Presentation Transcript

  • 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
  • GRAZIE © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 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.
  • GEOLOCATION © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • • • 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
  • 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
  • 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.
  • 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.
  • 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.
  • TESTING GEOLOCATION WITH EMULATOR © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • GEOLOCATION DEMO © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • MAP CONTROL © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 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.
  • MAPS API KEY © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • MAP DEMO © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • HERE APPLICATIONS © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 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.
  • HERE LAUNCHERS API © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.
  • 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.
  • 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.
  • 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.
  • 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.
  • Grazie! © 2013 Nokia. All rights reserved. © 2013 Microsoft. All rights reserved.