Android user positioning (1)

Source: Internet
Author: User

User location is mainly used to obtain the user's location and track users' movements.

Key APIs:

Location manager is used to manage the user positioning service of Android. Location provider provides multiple positioning methods for developers to use.

Classification of positioning methods:

1. To use GPS satellites for positioning, you must gain the permission Android. Permission. access_fine_location in androidmanifest.

2. Network Positioning: positioning using the signal receiving tower and Wi-Fi intervention points requires the permission Android. Permission. access_fine_location or android. Permission. Access. coarse_location in androidmanifest.


// Follow these steps to obtain the current user location:

A. Known permissions in androidmanifest

B. Obtain the locationmanager object:

Locationmanager manager = (locationmanager) getsystemservice (context. location_service );

C. Select locationprovider

Call the requestlocationupdate method of the locationmanager object

D. Implement the locationlistener and overwrite its abstract method.

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.