开发者

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 开发者_StackOverflow中文版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? :)


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜