NEON TNC2010, May 31, Vilnius Maarten Koopmans for UNINETT Sigma [email protected].
Maarten Struys Windows Mobile Evangelist Alten-PTS Session Code: WMByyy.
-
Upload
buddy-johnston -
Category
Documents
-
view
212 -
download
0
Transcript of Maarten Struys Windows Mobile Evangelist Alten-PTS Session Code: WMByyy.
Creating Location Aware Windows Mobile Apps
Maarten StruysWindows Mobile EvangelistAlten-PTSSession Code: WMByyy
Agenda
IntroductionRetrieving Location Information
Making use of Cell TowersMaking use of IP AddressMaking use of GPS
Developing Location-Aware applicationsWeb Services, Location, Windows Mobile and you
Conclusion
IntroductionLocation-Aware Applications
Technology offers a huge potentialAll about Positioning and Content
More than drawing maps inside applications
Navigation softwareLocalized news, weather, traffic, sportsDevice can tell others where it is
Tracking people or carsSocial Networking
IntroductionLocation and Windows Mobile
Most Windows Mobile Devices are phonesUse Cell Tower information for fast location fetch
Make use of existing lookup functionality
Most Windows Mobile Devices have WIFIUse access point for accurate, fast location fetch
Make use of Geo IP lookup services
More devices ship with built-in GPS hardwareUse GPS Intermediate Driver to retrieve locations
Managed wrappers available in Windows Mobile SDKs
Location RetrievalCell Tower
Fast but relatively inaccurate Location FetchAccuracy higher in densely populated areas
Works if there is phone coverageRetrieve Cell Tower Information through RIL
RIL_Initialize(); RIL_Deinitialize();RIL_CellTowerLookup();
Pass Cell Tower Information to a Lookup Servicehttp://www.codeproject.com/KB/mobile/DeepCast.aspxby ‘Acoustic’
Retrieving Location using Cell Towerdemo
Location RetrievalIP Address Lookup
Fast and reasonably accurate Location FetchAccuracy higher in densely populated areas
Works if there is WIFI coveragePass IP number to a Lookup Service
Retrieving Location using IP numberdemo
Location RetrievalGPS
Initial reading might be slow but very accurate Location FetchDoes not work well (if at all) inside buildingsLocation information available without additional lookup servicesEasy accessible through GPS Intermediate Driver
Windows Mobile 5 and Windows Mobile 6
Location RetrievalGPS Intermediate Driver
Allows ‘high level’ access of the GPS Hardware by using the ‘parsed API’
No need to parse NMEA strings yourselfFor applications, the GPS Intermediate Driver looks like the physical GPS hardwareFor the GPS hardware, the GPS Intermediate Driver is the single client using itLocation changes will be delivered event driven on a separate thread
Location RetrievalGPSID and Managed Applications
Microsoft.WindowsMobile.Samples.Location
Location RetrievalTesting GPS readings with FakeGPS
Allows testing location aware applications without having GPS hardware on the deviceAlso ideal for poor satellite receptionRequires no changes to your applicationFakes data received by the GPS APIs\Program Files\FakeGPS\GPSFiles
Contains NMEA dataYou can record your own NMEA data
Receiving Location through GPSdemo
Location Aware ApplicationsMake them independent of Location Retrieval
Different Location Retrieval methods have different accuraciesThe easiest to in your application is abstracting location retrieval
Use a Class FactoryRetrieve Location readings through an InterfaceApplication is only interested in Lat/Long readings, not where they come from
Location Aware ApplicationsDifferent catagories of applications
Line-of-Business ApplicationsFleet tracking + Route planning
Device publishes its location
Consumer ApplicationsOften a Collaboration between the Cloud & DeviceSmart Client Application (e.g. pictures + location)Location Aware bloggingSocial NetworkingFinding Friends
Location Aware ApplicationsSample Applications
Bing MobileGoogle MapsUpdate Twitter Status and automatically add location (+ optional link to a map)Share information with friends through Fire EagleAll kinds of Windows Live Services
Bing Maps alone has lots of different services
Sample: Updating Twitter Status
string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes (Properties.Resources.TwitterUserName + ":" + Properties.Resources.TwitterPassword));StringBuilder sb = new StringBuilder("status=");sb.Append(locationInfo);if (additionalInfo != string.Empty){ sb.Append(" - "); sb.Append(additionalInfo);}byte[] data = Encoding.ASCII.GetBytes(sb.ToString());
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(TwitterStatusUpdateURI);request.Method = "POST";request.Headers.Add("Authorization", "Basic " + user);request.ContentType = "application/x-www-form-urlencoded";request.ContentLength = data.Length;Stream reqStream = request.GetRequestStream();reqStream.Write(data, 0, data.Length);reqStream.Close();
Location Aware ApplicationsRetrieving Maps through Bing Maps
Imagery ServiceMaps & Imagery for Mobile Devices
Search ServiceQueries to find keywords or locations
Geocode ServiceAddress to LatLong and LatLong to Address
Route ServiceGet directions and traffic info
Sample: Displaying Bing Maps
public Image GetMap(double latitude, double longitude){ // Set the location of the requested image mapUriRequest.Center = new VEImageryService.Location(); mapUriRequest.Center.Latitude = latitude; mapUriRequest.Center.Longitude = longitude; mapUriRequest.Center.LongitudeSpecified = true; mapUriRequest.Center.LatitudeSpecified = true;
// Retrieve a map (jpg) through a URL, provided by Virtual Earth MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(mapUriResponse.Uri); HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Image img = new Bitmap(response.GetResponseStream()); response.Close();
return img;}
Location Aware ApplicationsRetrieving information through Bing Services
Consistent Web Service to retrieve all kinds of information
MobileWebAdvertisementsImagesPhoneBook
Learn how to access one source of information and you know how to access them all
Sample: Using Bing Services
private void button1_Click(object sender, EventArgs e){ using (LiveSearchService service = new LiveSearchService()) { SearchRequest request = new SearchRequest(); request.AppId = Properties.Resources.LiveSearchAppID; request.Query = searchQuery; request.Sources = new SourceType[] {SourceType.MobileWeb }; SearchResponse response = service.Search(request);
foreach (MobileWebResult r in response.MobileWeb.Results) { listView1.Items.Add(new ListViewItem(r.Title)); } }}
A Location Aware Sample Applicationdemo
Summary
There are several ways to retrieve Location Information
Cell Tower Lookup; IP Number Lookup; GPSAdding Location to Windows Mobile Applications extend application richnessThink out of the Box
Make use of Web Services / Web Apps to increase the functionality of Windows Mobile Applications
Great opportunities for Business and Consumer oriented applications
question & answer
www.microsoft.com/teched
Sessions On-Demand & Community
http://microsoft.com/technet
Resources for IT Professionals
http://microsoft.com/msdn
Resources for Developers
www.microsoft.com/learning
Microsoft Certification & Training Resources
Resources
Complete an evaluation on CommNet and enter to win an Xbox 360 Elite!
© 2009 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.