============ Problem Description ============
The Great God of you:
How to integrate GPS, base station positioning, WiFi positioning effectively integrated, so that the system based on the network to make effective positioning method, thank you
============ Solution 1============
Upstairs, that's right, implement the Locationlistener onlocationchanged,onproviderdisabled,onproviderenabled,onstatuschanged interface.
============ Solution 2============
But base station location and WiFi location (IP) or need a third-party package depends on Ah, otherwise you will have to set up the base station database, get all the base station data, IP is the same, can be resolved.
============ Solution 3============
So you've registered two provider, Gps_provider & Network_provider. But there are still problems. GPS accuracy is high and reliable, but the stability is poor, network mode is fast but unreliable, because the location depends on the agent you use and other reasons. As for your original intention "the system according to the network environment to make an effective positioning method", this can do an interactive choice for users to choose if the GPS can't get location using network location, if both methods have location information, and error more than a certain degree, let the user decide which to use.
Reference 9 Floor Tomkan's reply:
Private Android.location.LocationManager Mlocationmanager;
Locationlistener [] mlocationlisteners = new locationlistener[] {
New Locationlistener (Android.location.LocationManager.GPS_PROVIDER),
New Locationlistener (Android.location.LocationManager.NETWORK_PROVIDER)
};
if (Mlocationmanager = = null) {
Mlocationmanager = (Android.location.LocationManager)
Mcontext.getsystemservice (Context.location_service);
}
if (Mlocationmanager! = null) {
try {
Mlocationmanager.requestlocationupdates (
Android.location.LocationManager.NETWORK_PROVIDER,
1000,
0F,
MLOCATIONLISTENERS[1]);
} catch (SecurityException ex) {
LOG.I (TAG, "fail to request location update, ignore", ex);
} catch (IllegalArgumentException ex) {
LOG.D (TAG, "provider does not exist" + ex.getmessage ());
}
try {
Mlocationmanager.requestlocationupdates (
Android.location.LocationManager.GPS_PROVIDER,
1000,
0F,
Mlocationlisteners[0]);
} catch (SecurityException ex) {
LOG.I (TAG, "fail to request location update, ignore", ex);
} catch (IllegalArgumentException ex) {
LOG.D (TAG, "provider does not exist" + ex.getmessage ());
}
LOG.D (TAG, "startreceivinglocationupdates");
}
Android location problem