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.