Location for Mobiles
-
Upload
rosetta-ardill -
Category
Documents
-
view
24 -
download
0
description
Transcript of Location for Mobiles
Bruce Scharlau, University of Aberdeen, 2011
Location for Mobiles
Mobile Computing
Some slides from MobEduNet
Bruce Scharlau, University of Aberdeen, 2011
Where… is the question answered by location
How do I get there?
How do I get there?
What’s around me?
What’s around me?
Where am I?
Where am I?
Bruce Scharlau, University of Aberdeen, 2011
Location needs context
Where am I going, and how am I travelling there?
Car/WalkCar/WalkBikeBike
??????
Bruce Scharlau, University of Aberdeen, 2011
LBS can be pulled by the client
Pull based scenarios let the user determine the interaction: get directions, find a shop, etc
Bruce Scharlau, University of Aberdeen, 2011
LBS push and pull the client
Push based scenarios let the service prompt the user: proximity based sending of adverts and coupons
Special voucher for startbucks
Bruce Scharlau, University of Aberdeen, 2011
Location can be determined a number of ways for mobiles
http://www.flickr.com/photos/timothymorgan/75699268/
Cell tower IDCell tower ID
Satellite GPSSatellite GPS
A- GPSA- GPS
Enhanced 911Enhanced 911
Local proximity for Bluetooth
Local proximity for Bluetooth
Bruce Scharlau, University of Aberdeen, 2011
Location methods all offer different features
• Real-time positioning methods
• Accuracy depends on the method used
• Different level of accuracy
• Warm-up time
Bruce Scharlau, University of Aberdeen, 2011
The output of the location also differs
• Location types:– Spatial term– Text description
• Text description is usually expressed as a street address, including city, postal code, etc.
Bruce Scharlau, University of Aberdeen, 2011
Spatial terms provide latitude-longitude-altitude
• Latitude: 0-90 degrees north or south of the equator
• Longitude: 0-180 degrees east or west of the prime meridian, which passes through Greenwich, England
• Altitude: meters above sea level
Go the ‘long way round’ to remember lat/long
• Latitude = north/south of the equator
• Longitude = east/west of Greenwich
Bruce Scharlau, University of Aberdeen, 2011
Bruce Scharlau, University of Aberdeen, 2011
Location can be determined a number of ways for mobiles
http://www.flickr.com/photos/timothymorgan/75699268/
Cell tower IDCell tower ID
Satellite GPSSatellite GPS
A- GPSA- GPS
Enhanced 911Enhanced 911
Local proximity for Bluetooth
Local proximity for Bluetooth
Bruce Scharlau, University of Aberdeen, 2011
Network based positioning uses Cell ID
• Device is communicating with a Base Transceiver Station (BTS)
• Current cell ID can be used to identify BTS
• Accuracy depends on the size of the cell:– A GSM cell may be anywhere from 2 to 20
kilometers in diameter– Other techniques used along with cell ID can
achieve accuracy within 150 meters
Bruce Scharlau, University of Aberdeen, 2011
Satellite based positioning• GPS is controlled by the US Department of Defense, and
other systems are also coming online • Determines the device's position by calculating
differences in the times signals from different satellites take to reach the receiver
• Most accurate method, between 4 and 40 meters• Disadvantages:
– Extra hardware can be costly– Consumes battery while in use– Requires some warm-up – „Canyon effects” in cities, where satellite visibility is intermittent
Bruce Scharlau, University of Aberdeen, 2011
Short-range positioning beacons use Bluetooth
• Small areas like single buildings
• Local area network can provide location
• Bluetooth for short-range positioning
Bruce Scharlau, University of Aberdeen, 2011
Accuracy is dependent upon the application
• Some applications don't need high accuracy:– Position information from a larger area
• Others will be useless if the location isn't accurate enough:– Navigation applications
Bruce Scharlau, University of Aberdeen, 2011
There are also other issues to consider
Where were you at?, asks the boss.
Where is the shipment?, asks the delivery man.
What is the pattern of behaviour for this customer?, asks the network operator.
All can be answered with Location data, but should they be?All can be answered with Location data, but should they be?
Nokia and maps the dark horse?
• Believe still long way to go with maps: generic now, tailored per context in future
• Crosss-platform HERE Maps with API for developers
• Combine maps with AR for more information and content
Bruce Scharlau, University of Aberdeen, 2011http://www.guardian.co.uk/technology/appsblog/2012/nov/14/nokia-here-maps-location
Foursquare is like a loyalty card• Analytics and Yield management: some 500,000 registered
merchants with dashboard allows merchants to claim their venue, run specials, and access a host of other data about how 15mn customers interact with their business in real-time.
• Customer loyalty: Foursquare wants to be "a digital version of a stamp card." This is where check-in specials come in: Free drinks for the mayor or for the nth check-in.
• Search and Discovery: Foursquare added the Explore feature a year ago to let users search neighborhoods and garner recommendations for nearby businesses.
• Deals: Foursquare has partnered with a number of daily deal sites over the past year to provide real-time location-based deals
http://www.businessinsider.com/bii-report-heres-how-location-based-services-like-foursquare-are-trying-to-become-big-businesses-2012-9
Bruce Scharlau, University of Aberdeen, 2011
Location apps not easy
• Facebook places is little-used by business; possibly as not mobile based app
• Google Latitude not done much and more of a bolt-on to maps
• Yelp both desktop (search for places to eat/drink/etc) and mobile with reviews etc, but mainly US
Bruce Scharlau, University of Aberdeen, 2011
Location based services aren’t corporate enough
• Security and privacy policies fine for individuals, but not at business level.
• People want more control over who sees where they are
• Location is really another form of social media
Bruce Scharlau, University of Aberdeen, 2011http://www.computerworld.com/s/article/9226785/Location_based_services_Are_they_there_yet_
LBS in iOS uses location + maps
• Core location provides ‘where’ someone is
• Maps handled by Map Kit Framework
• Geocoding to move from lat/long to place objects (address, building, etc) on map
• Reverse geocoding also possible
• Issue with maps at moment…
Bruce Scharlau, University of Aberdeen, 2011
And where is Aberdeen?
What’s the latitude and longitude of Aberdeen?
Bruce Scharlau, University of Aberdeen, 2011
Aberdeen is west of London
Bruce Scharlau, University of Aberdeen, 2011
http://www.earthtools.org/
57.1467°N 2.0901°W
Use Google API for location
• Select Google APIs for new projects using maps and location
• Otherwise your app won’t run
Bruce Scharlau, University of Aberdeen, 2011
Also put permissions in manifest
• Need to add permissions for
• INTERNET
• ACCESS_COURSE_LOCATION
• ACCESS_FINE_LOCATION
Bruce Scharlau, University of Aberdeen, 2011
Manifest also needs to specify map library
Apps with maps need to specify need as ‘true’ for com.google.android.maps library in manifest
Bruce Scharlau, University of Aberdeen, 2011
Map layouts need API key
• Need to get Google MAPs API key to use maps in your apps – referenced in layout
Bruce Scharlau, University of Aberdeen, 2011
http://code.google.com/android/add-ons/google-apis/mapkey.html
This allows map tiles to be downloaded to your application
Direction API for routes included
Bruce Scharlau, University of Aberdeen, 2011
Can use direction API within maps API for routes
http://www.anddev.org/google_driving_directions_-_mapview_overlayed-t826.html
LocationListener updates map
Bruce Scharlau, University of Aberdeen, 2011
This is about as simple as it gets for map display
http://www.vogella.de/articles/Android/article.html#locationapi
Use DDMS tool to set location
Bruce Scharlau, University of Aberdeen, 2011
Geocoder library to look up location
Bruce Scharlau, University of Aberdeen, 2011
Why hasn’t LBS taken off?
• LBS ads since 2000, so why only worth $685mil in 2012?
• Ring tones by comparison had grown to be worth $5bil in 12 years
Bruce Scharlau, University of Aberdeen, 2011
http://communities-dominate.blogs.com/brands/location-based/
LBS is a distraction leading to wrong offering
If I’m not where I thought I’d be when something is to be delivered, do I want it delivered to where I am now?
Bruce Scharlau, University of Aberdeen, 2011
http://communities-dominate.blogs.com/brands/location-based/
If I’m looking at a map, do I always want it centred on where I am now?
Location limits your business
Why limit LBS adverts to when you’re there?
Bruce Scharlau, University of Aberdeen, 2011
Same advert to all possible customers catches more people? Eg florist, restaurant so can plan ahead
http://communities-dominate.blogs.com/brands/location-based/
Context is more important than location
Location is one attribute among many, and proximity could be good too, but both are subservient to context
Bruce Scharlau, University of Aberdeen, 2011
http://communities-dominate.blogs.com/brands/location-based/
Pay attention to what the person is doing and their current goal and you’ll do better
Summary
• Maps need API key to be displayed
• Maps needs permissions set in manifest
• Maps need API enabled
• Lots of work done over network
Bruce Scharlau, University of Aberdeen, 2011
Bruce Scharlau, University of Aberdeen, 2011
Location API for Java ME is JSR 179
• JSR 179: javax.microedition.location package
• Physical location
• Orientation (compass direction)
• Support the creation and use of databases of known landmarks, stored in the device
Bruce Scharlau, University of Aberdeen, 2011
The Location API has only a few components
Source: Nokia Location Guide
Bruce Scharlau, University of Aberdeen, 2011
JSR 179 requires CLDC 1.1
• Connected Device Configuration (CDC) or Connected Limited Device Configuration 1.1 (CLDC) for floating-point numbers
• CLDC 1.0 does not support floating-point numbers
• No requirements for MIDP
Bruce Scharlau, University of Aberdeen, 2011
Hardware determines the other requirements, ie BT, GPS, orientataion
• Hardware platform determines which location methods are supported
• At least one is needed for using LBS
• Request providers with particular characteristics, such as a minimum degree of accuracy
• Some location methods may be free; others may entail service fees
Bruce Scharlau, University of Aberdeen, 2011
Using Java ME the Location API starts with a Criteria
Need a LocationProvider, but can only call that once you know the criteria for choosing one: cost, accuracy, etc
Criteria c = new Criteria();LocationProvider lp = LocationProvider.getInstance(c);
Bruce Scharlau, University of Aberdeen, 2011
Don’t need to write any extra code to get coordinates from Bluetooth GPS
API checks for ‘best’ LocationProvider given the Criteria requirements
If it finds an ‘on-board’ device, then it uses that.
If not, then it checks the Bluetooth list of devices for a suitable one, and uses this.
Bruce Scharlau, University of Aberdeen, 2011
With a LocationProvider you can call getLocation() to find your location
No matching LocationProvider returns null, and a LocationException if no LocationProviders are available
Location location = lp.getLocation(10); // timeout in seconds
QualifiedCoordinates qc = location.getQualifiedCoordinates();double lat = qc.getLatitude();double lon = qc.getLongitude();
Bruce Scharlau, University of Aberdeen, 2011
Get period updates on your position with LocationListener
// method added by LocationListenerpublic void locationUpdated(LocationProvider provider, Location location) {
QualifiedCoordinates qc = location.getQualifiedCoordinates();double lat = qc.getLatitude();double lon = qc.getLongitude();String latString = Double.toString(lat);String lonString = Double.toString(lon);log("locationUpdated(): " + latString + " " + lonString);
}
// method added by LocationListenerpublic void providerStateChanged(LocationProvider provider, int newState) {
log("providerStateChanged()");}
Bruce Scharlau, University of Aberdeen, 2011
Use ProximityListener to find out when you’re close to a location
These only work on supported devices
Bruce Scharlau, University of Aberdeen, 2011
The LandmarkStore provides a location database
LandmarkStore.createLandmarkStore("Auction");
String[] stores = LandmarkStore.listLandmarkStores();
Easy to create a LandmarkStore
All LandmarkStores available to ALL Java ME apps
Bruce Scharlau, University of Aberdeen, 2011
Find your LandmarkStore and then add landmark
LandmarkStore ls = LandmarkStore.getInstance("Auction");
qc = new QualifiedCoordinates(35.977876, -78.514786, Float.NaN, Float.NaN, Float.NaN);
Landmark landmark = new Landmark("Baseball park","Forest Park", qc, null);ls.addCategory("Sports");ls.addLandmark(landmark, "Sports");
Bruce Scharlau, University of Aberdeen, 2011
Find landmarks meeting set criteria using Enumeration
Enumeration ge = ls.getLandmarks(null, 35.963280, 36.010783, -78.555336, -78.483582);
while (ge.hasMoreElements()) {Landmark found = (Landmark) ge.nextElement();log(" " + found.getName());
}
ls.getLandmarks(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude);
Bruce Scharlau, University of Aberdeen, 2011
You may also be able to determine the Orientation of the device
Orientation provides an understanding of ‘North’ either as magnetic, or ‘true North’ as ‘magnetic north’ moves over time
This can be used in some devices such as the N95 as a type of ‘accelerometer’ similar to what is used in the Wii controls
Bruce Scharlau, University of Aberdeen, 2011
Nokia’s TouristRoute example provides a LBS and MVC study
Source: Nokia Location Guide
Bruce Scharlau, University of Aberdeen, 2011
TouristRoute startup follows criteria requirements
Source: Nokia Location Guide
TouristRoute is ‘blueprint’ of sorts, but raises questions too
• Uses many classes – decomposses objects and views
• Might be better to use fewer, test if need performance, or other issues resolved
Bruce Scharlau, University of Aberdeen, 2011
Bruce Scharlau, University of Aberdeen, 2011
Further references for Location API
• http://www.ibm.com/developerworks/edu/wi-dw-wi-mobilesa-i.html IBM example that shows how to use external event tool in WTK (registration required)
• http://www.forum.nokia.com/main/resources/technologies/location_based_services/java.html Nokia tutorial also good on using its tools, and on MVC design for larger app