Android的运行GPS定位 - BlackBerry设备 - 不工作 [英] Android Runtime GPS Location - Blackberry Device - not working

查看:207
本文介绍了Android的运行GPS定位 - BlackBerry设备 - 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用已经从Android的移植到黑莓和它工作正常...

My app has been ported from Android to blackberry and it works fine...

不工作的唯一事情就是GPS定位其在Android工程....

the only thing not working is the GPS location which works on the android....

应用程序显示一个消息给使用我们正在努力寻找的位置,如果没有位置发现告诉我们,我们不能检索位置的用户。

the app displays a message to the using that we are trying to find the location and if no location is found we tell the user that we could not retrieve a location..

这里是code

private void gpsLocation()
   {
         //Get the location manager
         locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
         //Provide Criteria
          Criteria criteria = new Criteria();
         provider = locationManager.getBestProvider(criteria, false);
          Location location = locationManager.getLastKnownLocation(provider);

         locationManager.requestLocationUpdates(provider, 400, 1, this);

         if(location != null){

                 onLocationChanged(location);
          } else{
                 Log.i(TAG, "no GPS location available - waiting for GPS fix");

                 Toast.makeText(getApplicationContext(), R.string.gpsWaitingToast, Toast.LENGTH_SHORT).show();

                if (Debug.GPS_USE_MONTREAL) {
                      currentLatitude = Double.valueOf(Debug.GPS_LAT_MONTREAL); currentLongitude = Double.valueOf(Debug.GPS_LNG_MONTREAL); // montreal
                 }
                 waitForGpsFix(GPSFIX_DELAY);
          }

它不工作,,我重新启动应用程序,,做到了旁边的一个窗口和所有的东西..

its not working,, I restarted the app ,, did it next to a window and all that stuff..

没有什么工作..

您的意见和帮助是极大的AP preciated。

your advise and help is greatly appreciated.

问候

推荐答案

有previously其中 LocationManager.NETWORK_PROVIDER 返回null一个bug,但仍可能在返回由 locationManager.getBestProvider()方法。这应该是固定在新的操作系统版本,但是。

There was previously a bug where LocationManager.NETWORK_PROVIDER returned null, which may still be returned by the locationManager.getBestProvider() method. This should be fixed in the newer OS builds, however.

如果您想立即解决您的code,所有你需要做的是设置:

If you'd like to fix your code immediately, all you would need to do would be to set:

provider = LocationManager.GPS_PROVIDER

在早期阶段, GPS_PROVIDER 是在播放器中实现的唯一供应商。

as in the early stages, GPS_PROVIDER was the only provider that was implemented in the player.

这篇关于Android的运行GPS定位 - BlackBerry设备 - 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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