Maps, geolocation, and geofencing - windows phone 8.1

  • View
    1.791

  • Download
    1

  • Category

    Mobile

Preview:

DESCRIPTION

http://winstore.vn

Citation preview

30 April 2014

Building Apps for Windows Phone 8.1 Jump Start

WinRT Apps & Silverlight

// The URI to launch

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

var uri = new Uri(uriToLaunch);

Windows.System.Launcher.LaunchUriAsync(uri);

// 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);

Location service

Core logic

CellWiFiGNSS

Geofence

core

Geofencing

WinRT API

Geofences

Microsoft

Positioning

Services

Geocoordinate

.NET API

Geofence

software

tracking

Geolocation

WinRT API

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.";

}

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;

}

}

awaitMapRouteFinder

awaitMapRouteFinder

MapRouteOptimization

awaitMapRouteFinder

awaitMapLocationFinder

awaitMapLocationFinder

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

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

©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.