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

查看:9
本文介绍了如何测试 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 状态做的事情 我在正确的轨道上吗???

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 ;
            }
        }
    };

我想测试设备是否是:

  • 没有变化
  • 新地点
  • 开始_
  • 没有 GPS 数据

您能举例说明 GPS 的状态吗??谢谢.

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天全站免登陆