Implementation and architecture of Location Service in Android system

Source: Internet
Author: User

Objective

Location service is one of the most commonly used functions on mobile devices, based on the Android source code, the architecture and implementation of the positioning service in Android system are analyzed in detail. The positioning service is a system service provided by the Android system, where all system services are similar in architecture. It's easy to understand just one and then understand the other. For Android application developers, this article can help them understand the implementation behind the APIs they use. For Android system developers, this article can help them better understand the Android architecture. For information on how to obtain the Android source, see the official website of Android Source: The http://source.android.com/source/downloading.html Android source contains a lot of files, some The source file is even the same name. In order to clearly indicate the file we are discussing, this article will indicate its path in the Android source tree when referring to the source file.

Android.location Package and API code example

The API that the location service provides to the application tier is located in the Android.location package, which contains classes and interfaces as shown in table 1:

In table 1, the most important class is Locationmanager, which is the entry class for the entire positioning service. Listing 1 is a code example that uses the positioning service API:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.