Analysis on the principle of Android mobile guard mobile positioning
Recommended reading:
Analysis of Android mobile guard SIM card binding
In depth analysis of MD5 encryption when Android mobile guards save passwords
Explain the Android mobile guard setup wizard page
Analysis of Android mobile guard turning off automatic update
On the properties of Android mobile guard custom controls
Analysis of Android mobile guards reading contacts
Analysis of Android mobile guards receiving SMS instructions and executing corresponding operations
There are three ways of mobile phone positioning: network positioning, base station positioning and GPS positioning
For network positioning, when the mobile phone is connected to WiFi 2g 3g, the mobile phone will have an IP, with great error
The accuracy of base station positioning is related to the number of base stations, with an error of tens of meters to several kilometers
GPS positioning requires at least three satellites to locate accurately in open places
The mobile phone uses A-GPS and needs the network to assist in positioning. The positioning speed is fast. The network records the last satellite orbit,
Get the locationmanager object through getsystemservice (location_service)
Call the requestlocationupdates() method of the locationmanager object to request location updates. Parameters:
Positioning method ("GPS"), update time (60000), update distance (50), locationlistener object
Locationlistener is an interface, and its implementation class needs to be made
Define mylocationlistener and implement the following methods
Onlocationchanged(), when the location changes, the callback passes in a location object
Call the getlongitude () method of the location object to get the longitude
Call the getlatitude () method of the location object to get the dimension
Call the getaccuracy () method of the location object to get the accuracy
Onstatus changed(), when the status changes, the callback is turned off and on
Onproviderenabled(), when a location provider is available
Onproviderdisabled(), when a location provider is unavailable
When the activity is destroyed, the listening location is cancelled
Override the ondestroy () method of the activity
Call removeupdates() of locationmanager object to cancel listening. Parameter: locationlistener object
Set the locationlistener object to null and garbage collection
Required permissions
android.permission.ACCESS_ FINE_ Location get the exact location android.permission.access_ COARSE_ Location get the rough location android.permission.access_ MOCK_ Location get the location of the simulation (when the simulator is developed)
On the simulator, the following positions can be displayed only after being sent in DDMS
The state has biased the coordinates and turned them into Martian coordinates, which requires the plug-in of the National Bureau of Surveying and mapping. There is a Martian coordinate conversion code on the Internet
The above is the principle of Android mobile phone guard mobile phone positioning introduced by Xiaobian. I hope it will be helpful to you!