草庐IT

ACTIVATE_LOCATION

全部标签

java - 如何从 android.location.Address 对象接收门牌号?

Listaddresses=newGeocoder(a).getFromLocation(latitude,longitude,1);Addressadr=addresses.get(0)//receivedifferentparamtersofanaddresspostalCode=a.getPostalCode();city=a.getLocality();county=a.getAdminArea();country=a.getCountryName();street=a.getThoroughfare();但是我如何收到门牌号呢?注意!a.getAddressLine(0)在单

android - 如何 ACCESS_FINE_LOCATION 保持 GPS 关闭?

我想从NETWORK_PROVIDER获取准确位置,同时关闭GPS以节省电量。这似乎是不可能的,因为android,当指定ACCESS_FINE_LOCATION时,即使没有向GPS_PROVIDER请求位置,也会打开GPS。我已经添加了:进入list。为了避免android混淆准确位置,我需要它。我只使用NETWORK_PROVIDER而不是GPS_PROVIDER注册了更新:myLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,60000,0,locationListener);无论如何,

java - import com.google.android.gms.location.LocationClient无法解析

我正在制作一个使用谷歌地图的安卓应用程序。在我将Eclipse从Juno升级到Luna之前,我的代码可以完美运行。我还更新了已发布的SDK的一些修订版。在此之后,我的代码中出现了很多错误(之前运行良好,可能来自Eclipse更新)。修复错误并重新导入库后,仍然存在一个错误“Theimportcom.google.android.gms.location.LocationClientcannotberesolved”。经过一些在线搜索后,我发现需要再次导入“google-play-services_lib”,但根据错误日志找不到它。我检查了项目的构建路径和属性,并且存在库和文件夹。我删除

Android 单元测试/Mockito : android. location.Location not mocked

我正在尝试学习在Android上进行基本的JUnit和Mockito测试。我正在尝试为一个简单的类编写单元测试,该类处理代表需要位置信息的Activity从位置服务中查找用户的位置。我一直在尝试创建“伪造的位置”来测试:@TestpublicvoidtestLocationReceived()throwsException{LocationfakeLocation=newLocation(LocationManager.NETWORK_PROVIDER);fakeLocation.setLongitude(100);fakeLocation.setLatitude(-80);...}但

android - FINE_LOCATION 的准确性低于 COARSE_LOCATION

根据我对在Android上访问位置的理解:位置提供者需要ACCESS_COARSE_LOCATION权限,精度较低,但检索位置速度更快。GPS提供商需要ACCESS_FINE_LOCATION权限,具有更高的准确性,但检索位置的速度较慢。为了更好地理解这一点,我运行了以下代码//Gothroughalistofalllocationproviderstogetthe"best"oneListlocationProviders=locationManager.getAllProviders();for(StringlocationProviderInit:locationProvider

Android Location.distanceTo(...) 和 Location.bearingTo(...) 没有返回正确的结果

我已经看过很多关于此的帖子,所以请不要将其标记为重复,因为它不是。所以运行下面的代码:privatevoidtestLocation(){doublecurrentLat=51.43376;doublecurrentLng=-2.86221;doubledestLat=51.43503;doubledestLng=-2.86869;finalfloat[]results=newfloat[3];Location.distanceBetween(currentLat,currentLng,destLat,destLng,results);Log.d("GPS","results[0]:"

android - 使用 Google Play Location API 获得速度

我正在使用来自新GooglePlayAPI(LocationClient类)的融合位置提供程序。但是方法Location.GetSpeed()没有返回正确的速度(显示0)。我读到我必须使用LocationManager类来获得速度,但是当我尝试LocationManager时出现了一个新问题。位置管理器NetworkProvider不工作,这是一个有问题的线程http://code.google.com/p/android/issues/detail?id=57707.那么获得运动速度的最佳方法是什么。我试着计算它的距离/时间,但它不准确.. 最佳答案

android - location 和 currentBestLocation 从哪里来?在 Android 开发指南中(获取用户位置)

我阅读了关于ObtainingUserLocation的教程在AndroidDevGuid中,我尝试使其适应以下代码..但我不知道应该将哪个位置值放入isBetterLocation(Locationlocation,LocationcurrentBestLocation)Example.classprivateLocationManagerlocman;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.m

android - 谷歌地图 Android API v2 : My location marker always over other markers?

目前正在将一个使用Googlemap的Android应用程序迁移到GoogleMapsAndroidv2;我希望map显示内置位置标记以及自定义标记。在以前的库中,我曾经在自定义标记“下方”绘制位置标记,使用mapView.setReticleDrawMode(ReticleDrawMode.DRAW_RETICLE_UNDER);我在新API中找不到类似的选项。我错过了什么吗? 最佳答案 经过一番搜索,我找不到这样的选项。我终于去掉了定位针,在map上加了一个类似的Marker和Circle;由于它是经典标记,因此它出现在其他标记

Android Location Client 无法解析方法

我正在尝试通过onConnected方法中的位置客户端请求位置更新。我的fragment实现了LocationListener、GooglePlayServicesClient.ConnectionCallbacks和GooglePlayServicesClient.OnConnectionFailedListener。代码如下所示。publicclassAnimatedMapFragmentextendsSupportMapFragmentimplementsLocationListener,GooglePlayServicesClient.ConnectionCallbacks,G