如何测试GPS状态? [英] How to test GPS status?

查看:415
本文介绍了如何测试GPS状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在创建一个应用程序,通过GPS来检测设备的位置,我有问题,GPS状态,我期待通过GpsStatus.Listener,但它的复杂,因为我与Android是一个新手。

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.

这是我尝试做GPS状态AM我在正确的轨道???

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 :

  • 没有改变
  • 在新的位置
  • 启动_
  • 在没有GPS数据

你能解释与例子??的GPSS状态,谢谢。

Can you explain the GPSs status with example??, thanks.

编辑: 伙计们,这非常有帮助,到目前为止,现在我坚持没有改变位置:当用户仍然停留在相同的位置,然后onLocationChange方法不会解雇我错了?所以我如何才能发送到服务器上测试它? :)

guys, it very helpful so far, now 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? :)

推荐答案

LocationManager ,GPS状态是有关GPS引擎本身没有位置通知和不可靠所有平台上的/设备,即使以确定是否有/有一个修复。

Look at LocationManager, GPS status is about the GPS engine itself not location notifications and is not reliable on all platforms/devices even to determine if you have/had a fix.

或者可以选择一个较旧的,但仍然具有现实意义教程

Or alternatively an older but still relevant tutorial

这篇关于如何测试GPS状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆