sayvortana
sayvortana

Reputation: 825

test gps no change location ?

I now create an app to detect the location of device through GPS, I have problem with GPS status, I look through the GpsStatus.Listener but it's complicated since I'm a newbie with Android.

Here is what I try to do with GPS status, am I on the right track?

final Listener onGpsStatusChange = new GpsStatus.Listener() {

    @Override
    public void onGpsStatusChanged(int event) {
        // TODO Auto-generated method stub
        switch(event){
        case GpsStatus.GPS_EVENT_STARTED:
        // Started...
        break ;
        case GpsStatus.GPS_EVENT_FIRST_FIX:
        // First Fix...
        break ;
        case GpsStatus.GPS_EVENT_STOPPED:
        // Stopped...
        break ;
        }
    }
};

I want to test whether device is :

no change
new location
start_
no gps data

I stuck with no change location: when user still stay on the same location then onLocationChange method will not fired am I wrong? so how can I test it in order to send to server? :)

Upvotes: 0

Views: 441

Answers (2)

romy_ngo
romy_ngo

Reputation: 1061

Using LocationListener is correct IMO. If you want to send user's location after a period of time even when he's not moving, getLastKnownLocation() might be what you're looking for. It will return with the lastest fixed location since the listener is called

Upvotes: 1

mibollma
mibollma

Reputation: 15118

What has the status GPS status to do with the users location? Shouldn't you use the LocationListener for the most part.

How much the user needs to move for a new update is controlled by minDistance.

Upvotes: 1

Related Questions