I am using GPS services to derive latitude & longitude in my App. I am able to get the latitude and longitude when the signal is avialable. Once i get a fix, if i have to go to a place where the GPS is not able to get a location fix, it still shows the last location. I want to get the current location and not otherwise. I have tried using onLocationChanged() and onGpsStatusChanged() both to get the GPS status but it isnt giving me the result.
@Override
public void onGpsStatusChanged(int arg0) {
// TODO Auto-generated method stub
if (event == GpsStatus.GPS_EVENT_STARTED) {
Log.d("zmenaGPS" , "GPS event started ");
GpsStatus gs = mlocManager.getGpsStatus(null);
Toast.makeText(getApplicationContext(),String.valueOf(gs),Toast.LENGTH_LONG).show();
} else if (event == GpsStatus.GPS_EVENT_STOPPED) {
Log.d("zmenaGPS" , "GPS event stopped ");
GpsStatus gs = mlocManager.getGpsStatus(null);
Log.d("zmenaGPSgps status" , String.valueOf(gs));
Toast.makeText(getApplicationContext(),String.valueOf(gs),Toast.LENGTH_LONG).show();
} else if (event == GpsStatus.GPS_EVENT_FIRST_FIX) {
Log.d("zmenaGPS" , "GPS fixace ");
Toast.makeText(getApplicationContext(),"First Fix",Toast.LENGTH_LONG).show();
} else if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) {
Log.d("zmenaGPS" , "GPS EVET NECO ");
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…