Your SlideShare is downloading. ×
2010 Sprint Developers Conference - Best Practices in Location Based Services
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

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

2010 Sprint Developers Conference - Best Practices in Location Based Services

369
views

Published on

Discussion of various aspects of developing mobile apps that utilize location-based services, including best practices for saving battery life and data transfer.

Discussion of various aspects of developing mobile apps that utilize location-based services, including best practices for saving battery life and data transfer.

Published in: Technology, Business

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
369
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
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
  • Sprint has partnered with many industry leading Solution Enablers.  Along with having access to Sprint services directly, Solution Enablers provide many value added services to help a customer deliver an optimized solution that meets their needs. Some of these value added services include: Custom Development Capabilities (mobile, server) and ongoing development support, System Integration (abilty to integrate with existing back-end systems, Hosting/Monitoring of the solution, User privacy opt-in/opt-out management (being compliant with Sprint and Legal mandates), Customer Care support, and other Web Services and web 2.0 capabilities.
  • Transcript

    • 1. 2010 Sprint Developer Conference Rodney Nelson / Manager - Product Platforms Mike McMullen / Product Manager - LBS Sean Barbeau / University of South Florida Oct. 26 - 28 Oct. 26 CASanta Clara, - 28
    • 2. © 2010 Sprint. This information is subject to Sprint policies regarding use and is the property of Sprint and/or its relevant affiliates and may contain restricted, confidential or privileged materials intended for the sole use of the intended recipient. Any review, use, distribution or disclosure is prohibited without authorization.2 Agenda Location Service Enablers - Partners Network Location APIs Smart Phone applications GpsOneXTRA Android Device Based Location Location in Femptocells Benchmarking GPS Accuracy Location Updates in Android Apps Battery-Life Best Practices Open-source LBS Tools and Data
    • 3. © 2010 Sprint. This information is subject to Sprint policies regarding use and is the property of Sprint and/or its relevant affiliates and may contain restricted, confidential or privileged materials intended for the sole use of the intended recipient. Any review, use, distribution or disclosure is prohibited without authorization.3 Location Enabler Partners Sprint has partnered with leading companies to allow developers to more easily utilize network based location Network Based GPS/Location
    • 4. © 2010 Sprint. This information is subject to Sprint policies regarding use and is the property of Sprint and/or its relevant affiliates and may contain restricted, confidential or privileged materials intended for the sole use of the intended recipient. Any review, use, distribution or disclosure is prohibited without authorization.4 Location Enablers Enhance your cloud application with location Web Application Service Enabler Sprint Location GW opt-in/out Location Enablers may also have access to other Sprint Service Framework APIs – SMS, MMS, Status, Device Info, etc.
    • 5. © 2010 Sprint. This information is subject to Sprint policies regarding use and is the property of Sprint and/or its relevant affiliates and may contain restricted, confidential or privileged materials intended for the sole use of the intended recipient. Any review, use, distribution or disclosure is prohibited without authorization.5 Location Interface getALocation – AAI (Advanced Application Interface) • Available now via the Sprint Services Framework • Web Services API (SOAP) version of MLP (Mobile Location Protocol) • Allows both CDMA and iDEN devices to be located > CDMA = Sprint / Virgin / Boost – Including 4G Handsets (EVO, EPIC) > iDEN = Nextel / Boost • Provides Velocity and Heading Information • Migration is easy > Use same Digital Certificate as BMF Parlay X API > Uses same opt-in/out methods as BMF Parlay X API Network Based Location API
    • 6. © 2010 Sprint. This information is subject to Sprint policies regarding use and is the property of Sprint and/or its relevant affiliates and may contain restricted, confidential or privileged materials intended for the sole use of the intended recipient. Any review, use, distribution or disclosure is prohibited without authorization.6 4G Mobile Broadband Location getLocation (Parlay X 3.0) • Available now via the Sprint Services Framework • For use with 4G/3G mobile broadband devices • Cell based location only > Wimax Cell Tower location when in 4G mode > CDMA Cell Sector location when in 3G mode Network Based Location API
    • 7. © 2010 Sprint. This information is subject to Sprint policies regarding use and is the property of Sprint and/or its relevant affiliates and may contain restricted, confidential or privileged materials intended for the sole use of the intended recipient. Any review, use, distribution or disclosure is prohibited without authorization.7 Enhanced Location – “V3” Enhanced Capabilities for Smart phones What is “V3?” • Server Requested Location of Sprint Devices • Sprint has partnered with Location Labs to provide Network APIs
    • 8. © 2010 Sprint. This information is subject to Sprint policies regarding use and is the property of Sprint and/or its relevant affiliates and may contain restricted, confidential or privileged materials intended for the sole use of the intended recipient. Any review, use, distribution or disclosure is prohibited without authorization.8 Enhanced Location – “V3” Why “V3?” • Enhanced Network Based Location Capabilities > Location Labs “Sparkle” Technology > Roaming Areas Supported > Geo-fencing Support > Location Streaming / Bread-crumbing > Wi-Fi location improves indoor results • 2011 Integration with new Smart phones Enhanced Capabilities for Smart phones
    • 9. 2010 Sprint Developer Conference Mike McMullen Sprint – Product Manager Oct. 26 CASanta Clara, - 28
    • 10. 10 Last Known Network Location Per Call Measurement Data (PCMD) Provided though the Sprint Services Framework • Location Recorded with each network connection • On the order of AFLT quality • Network initiated location • Very Low Latency • Partnering with AirSage Fast, Inexpensive Network Location
    • 11. 11 Smart Phones & Connection Cards PDE access is limited because we have no SW control Legacy Device Use MS-Based Location • GPS Quality Location • PDE is accessed every few hours • Device launched in the last year … > Maintain initial or pre-fix fix until GPS is available > The Pre-Fix is a terrestrial quality fix > Uncertainty will give an indication of the quality Coming Devices will use gpsOneXTRA • Also Android 2.2 upgrades • GPS Quality Location • No Indoor Capability Device Based GPS or “Outdoor” Location Only
    • 12. 12 gpsOneXTRA All new Smart Devices and later, Connection Cards will take advantage of this predictive ephemeris technology • No PDE Access • Ephemeris download good for up to 7 days • Accuracy Degrades over time > Sprint will update every 48 hours • If Device has strong signal it will go into an Autonomous mode with no degraded accuracy • Each download is approximately 38.5 Kbytes • Autonomous GPS functionality when out of coverage • Application can request refresh of assistance data > LocationProvider.sendExtraCommand() Device Based A-GPS Solution
    • 13. 13 Android Location GPS Provider • Legacy Devices – MS-Based with pre-fix capability • New devices use gpsOneXTRA – Starting with LG LS670 launching 31 October Network Provider • Google / OEM prerogative – Sprint Cell Tower Location – Google WiFi Location – Google Network Data GPS and Network Capabilities
    • 14. 14 Cell Tower to Cell Sector conversion Sprint broadcast CLM (Course Location Message) • Current Broadcast > Longitude / Latitude of the cell tower • Next year’s Broadcast > Longitude / Latitude the Cell Sector Centroid • Accessible on Android and Blackberry devices More accurate and always available 12.56 Square Miles 3.14 Square Miles 2 Miles 1 Mile A = π R2
    • 15. 15 Carrier Network is Import for CLM Some Carriers broadcast are suspect •Latitude / Longitude all zeros •A group all the same •Reversed Polarity Sprint maintains accurate CLM on Cell Tower Broadcast •Sample Code TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); if(tm.getNetworkOperatorName().equalsIgnoreCase("SPRINT")) { //you are on the Sprint network }
    • 16. 16 Femto Cell Location Same as CLM from the tower only more accurate • User Network Provider/CLM (Course Location Message/Cell Tower Broadcast) • 50 meters accurate • Femto Cells NID 501, 502 and 503 • Sample Code Available on Device Based and Network Based Location TelephonyManager tm = (TelephonyManager) getSystemService(Service.TELEPHONY_SERVICE); // Call below requires permission ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION CellLocation cl = tm.getCellLocation(); // check to see if the instance is CDMA if (cl instanceof CdmaCellLocation) { // yes – proceed to read CDMA specific values CdmaCellLocation cdmaCl = (CdmaCellLocation) cl; int baseStationId = cdmaCl.getBaseStationId(); int nid = cdmaCl.getNetworkId(); int sid = cdmaCl.getSystemId();
    • 17. 2010 Sprint Developer Conference Sean J. Barbeau Research Associate University of South Florida Oct. 26 CASanta Clara, - 28
    • 18. University of South Florida Research • Improve efficiency of location-based services through intelligent software • Create innovative location-aware applications Education • Train future workforce in mobile information systems software development through: > Research assistantships > Classroom education Commercialization • Indentify commercial partners • License relevant technology • Ongoing partnership for research and career track for students 18 Location-Aware Information Systems Lab
    • 19. University of South Florida • First navigation app for public transportation using GPS-enabled mobile phones • Alert user when to get off the bus with audio, visual, and tactile prompts > “Get Ready…” > “Pull Cord Now!” • Target simplicity, with cognitively disabled in mind • Successful field testing at five Florida transit agencies 19 Working with Industry for Real-world Solutions Dajuta has partnered with USF to launch the “Travel Assistance Device (TAD)”
    • 20. GPS Data Characteristics Can Vary 20 Two major influences 1. Mobile Device Hardware & Software > GPS hardware sensitivity > Antenna quality and device integration > Assisted vs. Unassisted GPS > MS-based vs. gpsOneXTRA > Firmware/software filters 2. Environment > Indoor / Outdoor > “Urban Canyons” > Building materials > Shielding by enclosure (e.g., purse, car)
    • 21. Benchmarking GPS accuracy is useful 21 Environment: Indoor, 2nd floor, on desk near window, Tampa, Fl Samsung Moment HTC EVO 4G172 meters 95th percentile: 550m 68th percentile: 398m 50th percentile: 335m Categorize devices for similar LBS app performance 172 meters
    • 22. 22 29.7 meters HTC EVO 4GHTC Hero Environment: Indoor, 2nd floor, on desk near window 29.7 meters
    • 23. Android LocationListener 23 Allows app to request position updates LocationListener has three primary settings: • “provider” – positioning technology (e.g. GPS, NETWORK) • “minTime” – requested time (milliseconds) between location updates • “minDistance” – requested distance (m) that triggers updates Behavior of devices can vary • Phone may not always follow given “minTime” between updates > If phone can’t get a GPS fix, it may not update for a long period of time > Some platforms ignore “minTime” setting and frequently update even if “minTime” is a large value – Can have a significant impact on battery life! Don’t make time assumptions based on number of updates • E.g., I’ve set minTime = 4 sec., I’ve gotten 5 updates, so 20 seconds have passed • Instead, check the system and/or location timestamps
    • 24. Android LocationListener 24 “minTime” behavior for GPS Setting “minTime”, “minDistance” = 0 provides updates as frequently as possible On some Android devices, extensive background tracking may require registering/canceling LocationListener, or filtering data from API, to achieve desired behavior Device Obeys “minTime”? Requires extra code Motorola i1 Yes No HTC Hero Yes* Optional* HTC EVO 4G Yes* Optional* Samsung Moment Yes* Optional* Samsung Epic 4G Yes* Optional* * Has unexpected behavior – see next slide
    • 25. Android LocationListener • Samsung Epic/Moment, HTC Hero/EVO update every second for ~9-11 GPS fixes, then sleep for “minTime” Ex. Using “minTime = 60 seconds”: 25 “minTime” behavior for GPS 0 10 20 30 40 50 60 70 80 90 1 12 23 34 45 56 67 78 89 100 111 122 133 144 155 166 177 188 199 210 221 232 GPS Fix ID TimeBetweenFixes(seconds)
    • 26. Android LocationListener 26 Useful Apps for Development and Testing “MyTracks”: • Open-source Android GPS tracking app with many features > Can record GPS and export to GPX, KML, CSV, TCX > See how LBS features are implemented in code > http://code.google.com/p/mytracks/ “OldTracks”: • Implements a “Mock” LocationProvider by loading GPX file > Your app registers for LocationListener updates (i.e., GPX file) played back by “OldTracks” provider > http://www.cl.cam.ac.uk/~acr31/android List of available LocationProviders on device
    • 27. Use GPS Sparingly to Save Battery Life 27 0 5 10 15 20 25 30 35 40 45 4 15 30 60 150 300 BatteryLife(hours) Interval Between GPS Fixes (sec) Impact of Interval Between GPS Fixes on Battery Life Sanyo Pro 200 Sprint CDMA EV-DO Rev. A network
    • 28. Pseudo-code for “GPS Auto-Sleep” if (Moving){ -Decrease LocationListener “minTime” } else{ if(Stopped for a reasonable amount of time){ -Increase LocationListener “minTime” } } • Useful for background tracking applications • Determining whether you’re moving or not can be difficult • Alternate approach for Android v2.2 and higher: > Use “PASSIVE” LocationProvider (instead of “GPS”) – Only updates your app if another app or service requests a location – “Scavenges” locations off other apps – But, no guaranteed updates 28
    • 29. GPS Outliers Prevent Efficient “Sleep” 29 0 50 100 150 200 250 300 1 22 43 64 85 106 127 148 169 190 211 232 253 274 295 316 337 358 379 400 421 442 463 484 505 526 547 568 589 610 631 652 673 694 715 736 757 778 799 820 841 862 883 904 925 946 967 988 1009 1030 TimeBetweenAdjacentGPSFixes(s) GPS Auto-Sleep Transitions - “Awake” to “Asleep” “Asleep” “Awake” Incorrect Activity!
    • 30. 30 It is Possible to Remove GPS Outliers •Beware – you will get outliers, more common on first few fixes as number of satellites in view changes •The Kalman Filter functions in a recursive fashion that works well online with real-time GPS data •Open-source Kalman Filters on the web: •http://tinyurl.com/27c86v3 •http://tinyurl.com/33ydrxm Modified Kalman Filter -82.5 -82.45 -82.4 -82.35 -82.3 1 15 29 43 57 71 85 99 113 127 141 155 169 183 197 211 Noisy Data -82.5 -82.45 -82.4 -82.35 -82.3 1 15 29 43 57 71 85 99 113 127 141 155 169 183 197 211 Less Noisy Data Outliers No Outliers!
    • 31. 31 Lightweight RESTful web services are preferred to XML- based SOAP implementations POST /busstoparrival/busstopws.asmx HTTP/1.1 Host: 73.205.128.123 Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/GetNextNVehicleArrivals" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetNextNVehicleArrivals xmlns="http://tempuri.org/"> <n>int</n> <RouteID>int</RouteID> <DirectionCodeID>int</DirectionCodeID> <BusStopID>int</BusStopID> <TripID_External>string</TripID_External> </GetNextNVehicleArrivals> </soap:Body> </soap:Envelope> SOAP Request via HTTP GET /busstoparrival/busstopws.asmx/GetNextNVehicleArrivals? n=string&RouteID=string&DirectionCodeID=string &BusStopID=string& TripID_External=string HTTP/1.1 Host: 73.205.128.123 RESTful HTTP Request •3.7 times more characters using SOAP! •Plus, many mobile platforms don’t natively support SOAP • Java ME • Android •If you have a choice, use RESTful web services Accessing Web Services from Phones
    • 32. 0 5 10 15 20 25 30 4 15 30 60 BatteryLife(hours) Interval Between Wireless Transmissions (s) JAX-RPC HTTP-POST REST-ful Web Services Save Energy 32 32 Motorola i580 - iDEN network Impact of JAX-RPC and HTTP-Post Operations on Device Battery Life
    • 33. http://code.google.com/apis/protocolbuffers/docs/javatutorial.html 33 Creating your own remote procedure calls (RPC)? Consider going really light-weight with Protocol Buffers •Are 3 to 10 times smaller, 20 to 100 times faster than XML •You implement a simple .proto file: message Person { required string name = 1; required int32 id = 2; optional string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2;} } •Java library handles serializing data into binary format for transmission, de-serializing when receiving data
    • 34. If you don’t need 100% delivery, consider User Datagram Protocol (UDP) 34 Impact of Transmission Protocols on Battery Life UDP does not provide handshake with server for packet “reliability”, but occasional loss of location data may be reasonable (< 3% fixes lost in tests)
    • 35. Receiving is cheaper than Transmitting If you’re exchanging information with a server, try to push it to the device, rather than have the device pull it 35 Device Transmitting vs. Receiving Receive Motorola i877 Java ME using UDP Transmit
    • 36. Critical Point Algorithm 36 36 All GPS Points Critical Points Only Try to send only necessary data from a device to a server
    • 37. Completely open-source trip planning solution • From map tiling to routing software • in Java/Javascript Uses OpenStreetMap data • Wikipedia for geographic information • Free data Can be integrated with device location to create new products 37 opentripplanner.org OpenStreetMap http://www.openstreetmap.org/
    • 38. Questions? Sean J. Barbeau, M.S. Comp.Sci. Research Associate Center for Urban Transportation Research University of South Florida 813.974.7208 barbeau@cutr.usf.edu USF Location-Aware Information Systems Lab http://www.locationaware.usf.edu/ 38
    • 39. © 2010 Sprint. This information is subject to Sprint policies regarding use and is the property of Sprint and/or its relevant affiliates and may contain restricted, confidential or privileged materials intended for the sole use of the intended recipient. Any review, use, distribution or disclosure is prohibited without authorization. Thank You! Learn more at http://developer.sprint.com 39