黑莓获取GPS位置 [英] Get GPS location on BlackBerry

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

问题描述

我无法用此功能来读取位置。当我试图让位置信息,它总是返回0海拔,经度0。

 无效getirGps(){
        标准myCriteria =新标准();
        myCriteria.setCostAllowed(假);        尝试
        {
            LocationProvider myLocationProvider =
                LocationProvider.getInstance(myCriteria);            尝试
            {
                位置myLocation = myLocationProvider.getLocation(300);                seTLatitude(myLocation.getQualifiedCoordinates()getLatitude()); //sunlarıda井公共静态沙地..
                seTLongitude(myLocation.getQualifiedCoordinates()getLongitude());
                Dialog.alert(纬度=+ GPSThread.latitude +茇+ GPSThread.longitude);
                速度= myLocation.getSpeed​​();
                标题= myLocation.getCourse();
                的timeStamp = myLocation.getTimestamp();
                nmeaString = myLocation.getExtraInfo
                    (应用程序/ X-JSR179-位置NMEA);
            }
            赶上(InterruptedException的IEX)
            {
                Dialog.alert(InterruptedException的);
                返回;
            }
            赶上(LocationException法)
            {
                Dialog.alert(LocationException法);
                返回;
            }
        }
        赶上(LocationException法)
        {
            Dialog.alert(LocationException lex2);
            返回;
        }    }
公共无效doThis(){    MapView类MapView类=新的图形页面();
    mapView.setLatitude((INT)Threads.latitude); // 39.9208,经度= 32.8541
    mapView.setLongitude((INT)Threads.longitude);
    mapView.setZoom(10);
    的MapsArguments mapsA​​rgs =新的MapsArguments(MapView类);
    Invoke.invokeApplication(Invoke.APP_TYPE_MAPS,mapsA​​rgs);    Dialog.alert(纬度=+ Threads.latitude +茇+ Threads.longitude);


解决方案

确保<一href=\"http://stackoverflow.com/questions/3989166/blackberry-widget-application-gps-location-is-always-0-0\">GPS功能是在设备上启用。

I can't read location with this function. When I try to get location information, it always returns altitude 0, longitude 0.

    void getirGps(){
        Criteria myCriteria = new Criteria();
        myCriteria.setCostAllowed(false);

        try
        {
            LocationProvider myLocationProvider =
                LocationProvider.getInstance(myCriteria);

            try
            {
                Location myLocation = myLocationProvider.getLocation(300);

                seTLatitude(myLocation.getQualifiedCoordinates().getLatitude());// sunlarıda bir public statıc dene..
                seTLongitude(myLocation.getQualifiedCoordinates().getLongitude());
                Dialog.alert("latitude = "+GPSThread.latitude +" longi"+GPSThread.longitude);
                velocity   = myLocation.getSpeed();
                heading    = myLocation.getCourse();
                timeStamp  = myLocation.getTimestamp();
                nmeaString = myLocation.getExtraInfo
                    ("application/X-jsr179-location-nmea");
            }
            catch ( InterruptedException iex )
            {
                Dialog.alert("InterruptedException");
                return;
            }
            catch ( LocationException lex )
            {
                Dialog.alert("LocationException lex");
                return;
            }
        }
        catch ( LocationException lex )
        {
            Dialog.alert("LocationException lex2");
            return;
        }

    }


public void doThis(){

    MapView mapView = new MapView();
    mapView.setLatitude( (int) Threads.latitude);//39.9208, Longitude = 32.8541 
    mapView.setLongitude((int) Threads.longitude);
    mapView.setZoom(10);
    MapsArguments mapsArgs = new MapsArguments(mapView);
    Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, mapsArgs);

    Dialog.alert("latitude = "+Threads.latitude +" longi"+Threads.longitude);

解决方案

Make sure the GPS functionality is enabled on the device.

这篇关于黑莓获取GPS位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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