Android commonly used three positioning methods are: based on GPS positioning, base station status, based on WiFi location.
1, based on GPS positioning:
GPS positioning needs GPS module (hardware) support, no GPS module is unable to GPS positioning.
GPS positioning the biggest advantage is its high positioning accuracy (general error in 10m), No network can also be used ; The disadvantage is high power consumption, slow positioning, indoor and basement basic positioning is not .
2, based on base station location:
Based on the collection of mobile phone base station information and mobile phone-related information (MNC, MCC, LAC) to locate, and then pass them to Baidu API or high-de API to obtain location information (own development cost is too large, Baidu and gold has provided the LBS interface platform )。
Base station positioning the biggest advantage is: fast positioning Speed , the disadvantage is: Positioning accuracy is slightly worse (around 200m), No network signal can not be used .
3, based on WiFi location:
Similar to the base station location, based on the current device to obtain Wi-Fi information to locate, Wi-Fi location accuracy is generally unaffected by the use of the environment, mainly and Wi-Fi radius, density. Wi-Fi positioning accuracy is currently around 20m
So how do we determine which method of our program is preferred to use for positioning?
This is typically done by looking at the definitions in Androidmanifest.xml, such as:
Android.permission.access_fine_location→gps positioning
android.permission.access_coarse_location→ Network Location
Android app positioning implementation principle:
By using Locationmanager( the User location service to manage Android ) to listen to the current location information and define the information to be returned (such as precision requirements, coordinates, orientation, etc.), you can see what the gold provides such as:
Note the point:
1, if the program has the right to open the GPS, the user set off the GPS but also to obtain the location of the demand will automatically open the GPS for positioning, positioning will automatically turn off the GPS;
2, the positioning must set the time-out period, or if it is not possible to locate the situation will remain stuck in the positioning can not exit the use of other functions;
3, if the time-out can be the location of the last position (Locationmanager has the method can get the position of the previous location), if the last location is empty, prompting the user to locate the failure.
What is the point of view when we measure a bit ?
1, check three kinds of positioning method positioning can be successful, accurate positioning accuracy and no error;
2, three kinds of positioning orthogonal combination, check the positioning function and positioning accuracy;
3, the program has to open the GPS access, shut down the network and GPS, check whether positioning and positioning accuracy;
4. Two processing conditions for failed positioning (failure prompt and whether to return to last position);
5, the positioning process and calls, short MMS, Bluetooth conflict;
6, the positioning process with the function key interaction;
7, different network environment (mobile, unicom, telecommunications in the 3g/2g) positioning speed and accuracy;
8, different environment (indoor, outdoor, elevator) positioning and accuracy;
9. Local test field positioning (DDMS simulation)
How to locate and test your Android