Presentation is loading. Please wait.

Presentation is loading. Please wait.

Android - Location Based Services. Google Play services facilitates adding location awareness to your app with automated location tracking Geo fencing.

Similar presentations


Presentation on theme: "Android - Location Based Services. Google Play services facilitates adding location awareness to your app with automated location tracking Geo fencing."— Presentation transcript:

1 Android - Location Based Services

2 Google Play services facilitates adding location awareness to your app with automated location tracking Geo fencing activity recognition use Location Services in your APP to get the current location get periodic location updates look up addresses

3 Location Services Android gives your applications access to the location services supported by the device through classes in the android.location package. The central component of the location framework is the LocationManager system service, which provides APIs to determine location and bearing of the underlying device. As with other system services, you do not instantiate a LocationManager directly. Request an instance from the system by calling getSystemService(Context.LOCATION_SERVICE). The method returns a handle to a new LocationManager instance.

4 Once your application has a LocationManager, your application is able to do three things: Query for the list of all LocationProviders for the last known user location. Register/unregister for periodic updates of the user's current location from a location provider (specified either by criteria or name). Register/unregister for a given Intent to be fired if the device comes within a given proximity (specified by radius in meters) of a given lat/long.

5 Set Up Google Play Services Download and install the Google Play services component via the SDK Manager and add the library to your project. Specify App Permissions Apps that use location services must request location permissions.

6 Android offers two location permissions: ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION. The permission you choose determines the accuracy of the location returned by the API. If you specify ACCESS_COARSE_LOCATION, the API returns a location with an accuracy approximately equivalent to a city block. Request this permission with the uses-permission element in your app manifest

7

8 Permission tag is used to enforce a user defined permission on a component of your application. Uses-permission tag is used to take a permission from the user for your application. Permission tag is used when you want other application to seek permission from the user to use some of your application components.

9 Challenges in Determining User Location Obtaining user location from a mobile device can be complicated. There are several reasons why a location reading (regardless of the source) can contain errors and be inaccurate. Some sources of error in the user location include: Multitude of location sources GPS, Cell-ID, and Wi-Fi can each provide a clue to users location. Determining which to use and trust is a matter of trade-offs in accuracy, speed, and battery-efficiency. User movement Because the user location changes, you must account for movement by re-estimating user location every so often. Varying accuracy Location estimates coming from each location source are not consistent in their accuracy. A location obtained 10 seconds ago from one source might be more accurate than the newest location from another or same source.

10 Flow for obtaining user location

11 The typical flow of procedures for obtaining the user location: Start application. Sometime later, start listening for updates from desired location providers. Maintain a "current best estimate" of location by filtering out new, but less accurate fixes. Stop listening for location updates. Take advantage of the last best location estimate.


Download ppt "Android - Location Based Services. Google Play services facilitates adding location awareness to your app with automated location tracking Geo fencing."

Similar presentations


Ads by Google