36
30 April 2014 Building Apps for Windows Phone 8.1 Jump Start WinRT Apps & Silverlight

Maps, geolocation, and geofencing - windows phone 8.1

Embed Size (px)

DESCRIPTION

http://winstore.vn

Citation preview

Page 1: Maps, geolocation, and geofencing - windows phone 8.1

30 April 2014

Building Apps for Windows Phone 8.1 Jump Start

WinRT Apps & Silverlight

Page 2: Maps, geolocation, and geofencing - windows phone 8.1
Page 3: Maps, geolocation, and geofencing - windows phone 8.1
Page 4: Maps, geolocation, and geofencing - windows phone 8.1

// The URI to launch

string uriToLaunch = @"bingmaps:?cp=51.501156~-0.141706&lvl=17";

var uri = new Uri(uriToLaunch);

Windows.System.Launcher.LaunchUriAsync(uri);

Page 5: Maps, geolocation, and geofencing - windows phone 8.1

// The URI to launch

string uriToLaunch = @"ms-drive-to:?destination.latitude=47.6451413797194"

+ "&destination.longitude=-122.141964733601&destination.name=Redmond, WA";

var uri = new Uri(uriToLaunch);

Windows.System.Launcher.LaunchUriAsync(uri);

Page 6: Maps, geolocation, and geofencing - windows phone 8.1
Page 7: Maps, geolocation, and geofencing - windows phone 8.1
Page 8: Maps, geolocation, and geofencing - windows phone 8.1
Page 9: Maps, geolocation, and geofencing - windows phone 8.1
Page 10: Maps, geolocation, and geofencing - windows phone 8.1
Page 11: Maps, geolocation, and geofencing - windows phone 8.1
Page 12: Maps, geolocation, and geofencing - windows phone 8.1
Page 13: Maps, geolocation, and geofencing - windows phone 8.1
Page 14: Maps, geolocation, and geofencing - windows phone 8.1
Page 15: Maps, geolocation, and geofencing - windows phone 8.1
Page 16: Maps, geolocation, and geofencing - windows phone 8.1
Page 17: Maps, geolocation, and geofencing - windows phone 8.1
Page 18: Maps, geolocation, and geofencing - windows phone 8.1

Location service

Core logic

CellWiFiGNSS

Geofence

core

Geofencing

WinRT API

Geofences

Microsoft

Positioning

Services

Geocoordinate

.NET API

Geofence

software

tracking

Geolocation

WinRT API

Page 19: Maps, geolocation, and geofencing - windows phone 8.1
Page 20: Maps, geolocation, and geofencing - windows phone 8.1

Geolocator geolocator = new Geolocator();

geolocator.DesiredAccuracyInMeters = 50;

try

{

Geoposition geoposition = await geolocator.GetGeopositionAsync(

maximumAge: TimeSpan.FromMinutes(5),

timeout: TimeSpan.FromSeconds(10) );

LatitudeTextBlock.Text = geoposition.Coordinate.Latitude.ToString("0.00");

LongitudeTextBlock.Text = geoposition.Coordinate.Longitude.ToString("0.00");

}

catch (UnauthorizedAccessException)

{

// the app does not have the right capability or the location master switch is off

StatusTextBlock.Text = "location is disabled in phone settings.";

}

Page 21: Maps, geolocation, and geofencing - windows phone 8.1

private void TrackLocation_Click(object sender, RoutedEventArgs e)

{

if (!tracking) {

geolocator = new Geolocator();

geolocator.DesiredAccuracy = PositionAccuracy.High;

geolocator.MovementThreshold = 100; // The units are meters.

geolocator.StatusChanged += geolocator_StatusChanged;

geolocator.PositionChanged += geolocator_PositionChanged;

tracking = true;

}

else {

geolocator.PositionChanged -= geolocator_PositionChanged;

geolocator.StatusChanged -= geolocator_StatusChanged;

geolocator = null;

tracking = false;

}

}

Page 22: Maps, geolocation, and geofencing - windows phone 8.1
Page 23: Maps, geolocation, and geofencing - windows phone 8.1

awaitMapRouteFinder

awaitMapRouteFinder

MapRouteOptimization

awaitMapRouteFinder

Page 24: Maps, geolocation, and geofencing - windows phone 8.1

awaitMapLocationFinder

awaitMapLocationFinder

Page 25: Maps, geolocation, and geofencing - windows phone 8.1
Page 26: Maps, geolocation, and geofencing - windows phone 8.1
Page 27: Maps, geolocation, and geofencing - windows phone 8.1
Page 28: Maps, geolocation, and geofencing - windows phone 8.1

Location service

Geofences storage

App

AppApp

Create fences

Trigger task

(BG)

Fence notification

(FG)

Background core

Read notification

info

Hardware based tracking

Geofence

tracking for all

apps

GeofenceMonitor

Optimized,

adaptive

software

tracking

Page 29: Maps, geolocation, and geofencing - windows phone 8.1

Id Required String N/A

Geoshape RequiredGeocircle

(BasicGeoposition + Radius)N/A

MonitoredStates Optional Entered/Exited/Removed Entered/Exited

SingleUse Optional True/False False

DwellTime Optional Timespan 10s

StartTime Optional DateTimeOffset 0/epoch

Duration Optional Timespan 0/forever

Page 30: Maps, geolocation, and geofencing - windows phone 8.1
Page 31: Maps, geolocation, and geofencing - windows phone 8.1
Page 32: Maps, geolocation, and geofencing - windows phone 8.1
Page 33: Maps, geolocation, and geofencing - windows phone 8.1
Page 34: Maps, geolocation, and geofencing - windows phone 8.1
Page 35: Maps, geolocation, and geofencing - windows phone 8.1
Page 36: Maps, geolocation, and geofencing - windows phone 8.1

©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics 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.