setLocationListener在黑莓不工作的GPS编程 [英] setLocationListener not working in Blackberry gps programming

查看:114
本文介绍了setLocationListener在黑莓不工作的GPS编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作基础的应用GPS。我使用LocationProvider并通过它调用setlocationListener code是像

I am working on gps based application. I am using LocationProvider and calling setlocationListener through it code is like

   LocationProvider lp = LocationProvider.getInstance(null);
        if (lp != null) {
            lp.setLocationListener(new LocationListenerImpl(), 2, 1, 1);
        } else {
            Dialog.alert("GPS NOT SUPPORTED!");
            retval = false;
        }
    } catch (LocationException e) {
        System.out.println("GPS Error: " + e.toString());
    }

    return retval;
}

private class LocationListenerImpl implements LocationListener {
    public void locationUpdated(LocationProvider provider, Location location) {
        if (location.isValid()) {
            heading = location.getCourse();
            longitude = location.getQualifiedCoordinates().getLongitude();
            latitude = location.getQualifiedCoordinates().getLatitude();
            altitude = location.getQualifiedCoordinates().getAltitude();
            speed = location.getSpeed();
            System.out.println("Current latitude:"+latitude);
            System.out.println("Current longitude:"+longitude);
            System.out.println("Current speed:"+speed);

            // This is to get the Number of Satellites
            String NMEA_MIME = "application/X-jsr179-location-nmea";
            satCountStr = location.getExtraInfo("satellites");
            if (satCountStr == null) {
                satCountStr = location.getExtraInfo(NMEA_MIME);
            }

            // this is to get the accuracy of the GPS Cords
            QualifiedCoordinates qc = location.getQualifiedCoordinates();
            accuracy = qc.getHorizontalAccuracy();
        }
    }


它不给出一个错误,但甚至不制定出这样的same.the控制帮助不得到转移到LocationListenerImpl()...
我使用BlackBerry_JDE_PluginFull_1.0.0.67与黑莓8800模拟器Eclipse的Java的伽利略-SR1-win32的..
任何assistence是grately AP preciated ....
请多关照。


it doesnt give an error but dont even work out so help with the same.the control dont get transferred to LocationListenerImpl()... I am using BlackBerry_JDE_PluginFull_1.0.0.67 with eclipse-java-galileo-SR1-win32 on Blackberry 8800 simulator.. Any assistence is grately appreciated.... Thanking you in advance.

推荐答案

试试这个:

lp.setLocationListener(new LocationListenerImpl(), 2, -1, -1);

加我
u盘2,1,1这意味着时间间隔2秒后的位置会选择更新自动调用
1 sec表示超时
1 sec表示最大年龄

Acc to me u set 2,1,1 which means that time interval is 2 sec after which location updation will be automatically called 1 sec indicates time out 1 sec indicates max age

去之前提前GPS位置更新method.so与将它设置为默认值尝试乌尔GPS超时= -1

ur gps times out before going ahead for gps location update method.so try it with setting it to default value = -1

这篇关于setLocationListener在黑莓不工作的GPS编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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