【问题标题】:get current location from GPS in Blackberry application在黑莓应用程序中从 GPS 获取当前位置
【发布时间】:2011-09-26 12:17:06
【问题描述】:

如何在 Blackberry 应用程序中从 GPS 获取当前位置。我试图在模拟器中从Locationmanager method 获取位置,它工作正常,但在我的设备中(使用 wifi 的 Storm 2)我无法获得当前的纬度。

我的代码

    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();  

            // 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();  
        }  
    }  

    public void providerStateChanged(LocationProvider provider, int newState) {  
        // no-op  
    }  
}

【问题讨论】:

  • 关于您的问题的信息不足 - GPS 是否打开?你的代码符合黑莓的方式吗?应用程序是否需要您不请求的权限?
  • GPS 已启用。是的,代码采用黑莓方式,从 GPS 系统发送 lat long 后,它在模拟器中工作。第三个关于许可?我不知道你在说什么许可?
  • 如果你有任何想法,请帮助我
  • @Hitarth:在设备选项中(在我的 Storm 9530 模拟器上,它位于“选项”->“安全选项”->“应用程序权限”-> 选择您的应用程序->“编辑权限”菜单项)的许可被命名为“位置数据”。

标签: blackberry gps blackberry-storm locationmanager


【解决方案1】:

我在寻找风暴问题的第一个地方发现了这个:If you run the above code on your BlackBerry device (for instance a Storm), you will get a "GPS not allowed" LocationProvider exception. You need to get your code signed if you want to use the BlackBerry Storm with GPS in your app. To do this, you need to buy a $20 certificate from RIM.

【讨论】:

  • 我的代码已经被烧了。孔应用程序在设备中运行良好。我的应用程序有一个名为“使用当前位置”的按钮,从此按钮单击事件获取当前位置并继续应用程序,但每次我得到 0.0 纬度和经度时在设备中。我有没有 SIM 卡的风暴 2 我正在使用孔应用程序使用无线网络。
  • 我的洞天西来解决这个问题,但我无法得到解决方案..如果你有任何关于相同的演示或建议,请帮助我
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多