Location Basics

getSystemService(Context.LOCATION_SERVICE);

system to find the best available location technology for the specified requirements. An example of selecting a location provider based on criteria is

Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_LOW); String locationprovider =

mLocationManager.getBestProvider(criteria, true);

It is also possible to specify the location estimation technology using the location manager's getProvider() method. The two most common providers are the satellite-based Global Positioning System (GPS) (specified by LocationManager.GPS_PROVIDER) and cell-tower identification (specified by LocationManager.NETWORK_PROVIDER).The former is more accurate, but the latter is useful when a direct view of the sky is not available such as indoors.

Unless otherwise noted, all recipes in this will utilize the following two support files. First, the main layout needs a TextView as shown in Listing 10.1 for displaying the location data.

Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook


Post a comment