Lecture 10: Locations Flashcards
What are the different ways of determining a users location?
- GPS/GNSS
- Network
- WiFi
How does GPS/GNSS work?
Uses satellite positioning to determine an exaction location
power expensive
How does network location work?
Provides an approximation of the users location using the location of a nearby cellular network tower
How does WiFi location work?
Uses an IP address lookup to check the approximate location of the user
What are the 2 types of location permissions?
- COARSE
- FINE
What are FINE permissions?
Precision determined by GPS
Quoted accuraxy of +/- 50m
What are COARSE permissions?
Precision determined by WiFi or Cellular Network
Quoted accuracy of +/- 3km^2
What is the downside to using GPS location?
Its very battery intensive and typically slow
What are the 2 practical problems you should consider when talking about location?
- How accurate do we need to be?
- Does the user have a choice?
How does modern android allow users to have a choice on what location permissions they use?
Allows the user to select either
- Precise
- Approximate
location services at runtim
What is the Fused Location Provide?
An API for fetching location data
Designed to handle all forms of location request (FINE or COARSE) with any location hardware (GPS, Network, WiFi)
Why use the Fused Location Provider?
More efficient use of location data and battery
How does Fused Location Provider save battery?
Minimizes the number of location request made and the amount of time location hardware is used for
Does this by re-using location requests made previously by other maps
What are the downsides of fused location provider?
Doesn’t case too much about minute-to-minute accuracy
Location refresh rate is tied to when other apps force a location update
In order to use the FusedLocationProvider we have to declare a __ of the provider
client
What are the 2 notable methods that the client uses?
- getLastLocation()
- getCurrentLocation()
What is getLastLocation()
A simple read-only request for the last known location
Location can be very stale
What is getCurrentLocation()
Intelligently cache location data and only force an updated request when the last location data is considered to old
Fused provider allows you to assign a ___ to each__ you make
- priority
- location request
What are the location priority levels?
- PRIORITY_HIGH_ACCURACY
- PRIORITY_BALANCED_POWER_ACCURACY
- PRIORITY_LOW_POWER
- PRIORITY_NO_POWER
What is the best way to actively track the user
Use the requestLocationUpdates() method on a FusedLocationProviderClient object to request regular location updates on a fixed time interval
How does the requestLocationUpdates() method work?
Takes parameters for the request and includes a callback method
every n time interval the callback method is called and passes the updated location variable containing the current location data
What are some of the things a location object holds?
longitude, latitude, altitude, compass, bearing, GPS satellite time