草庐IT

sub_location

全部标签

android - 谷歌位置 API : request location updates with pending intent?

我已经开始使用thistutorial实现GoogleLocationAPI.我已经设法让它在我的应用程序中正常工作,它会以正确的时间间隔更新我的位置等。现在我正在研究如何在设备处于sleep模式时更新我的​​位置。根据documentation,这种方法是要走的路:publicvoidrequestLocationUpdates(LocationRequestrequest,PendingIntentcallbackIntent);我的问题是,如何设置此PendingIntent,以及如何处理它?我看过有关如何处理其他类型Intent的教程,但我不确定如何将它们应用到此。

Window.location用法

Window.location详细介绍本文翻译自@samanthaming发表于dev.to的博文原文地址window.locationCheatsheet-DEVCommunity👩‍💻👨‍💻如果你需要获取网站的URL信息,那么window.location对象就是为你准备的。使用它提供的属性来获取当前页面地址的信息,或使用其方法进行某些页面的重定向或刷新。https://www.samanthaming.com/tidbits/?filter=JS#2window.location.origin→'https://www.samanthaming.com'.protocol→'https:

android - 我想使用 google fused location api 获得准确的位置?

我正在使用FusedlocationApi,我得到的位置精度约为10米。有时它提供4到8米的精度。我希望使用此融合位置Api或任何其他方式获得更高的准确性。有什么方法可以获取精度小于4米的位置。我正在通过这种方式获取位置。publicclassGetCurrentLocationimplementsConnectionCallbacks,OnConnectionFailedListener,LocationListener{privatestaticfinalStringTAG="location-updates-sample";publicstaticfinallongUPDATE_

android - LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, 这个);尝试转换为 com.google.android.gms.location.LocationListener)

我已经在Android上设置了一个基于位置的map,但是当我尝试调用时:LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient,this);Androidstudio试图让我将其转换为LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient,(com.google.android.gms.location.LocationListener)this);然而,这会导致应用程序在调用时崩溃。我的应用有以下位置代码:

android - android.location.LocationManager.PASSIVE_PROVIDER 是什么意思?

我理解GPS_PROVIDER的意思(位置来自GPS信号)和NETWORK_PROVIDER(位置由手机信号塔和无线接入点确定),但我不明白PASSIVE_PROVIDER的含义,尽管API中有定义:Aspeciallocationproviderforreceivinglocationswithoutactuallyinitiatingalocationfix.Thisprovidercanbeusedtopassivelyreceivelocationupdateswhenotherapplicationsorservicesrequestthemwithoutactuallyre

android - 权限 ACCESS_MOCK_LOCATION 被忽略?

我没有做过广泛的测试,但有证据表明应用程序list中的android.permission.ACCESS_MOCK_LOCATION并不像人们假设的那样工作(即如果存在-允许模拟位置提供者,否则不允许)。所以像https://play.google.com/store/apps/details?id=com.lexa.fakegps这样的假GPS应用程序与任何应用程序一起工作,无论它是否设置了ACCESS_MOCK_LOCATION。如果用户允许设备设置中的虚假位置似乎就足够了。也许ACCESS_MOCK_LOCATION真的意味着应用程序本身可以是模拟位置提供者?如果是这样,那么它应

android - 尽管在 list 文件中指定了权限,但 ACCESS_FINE_LOCATION SecurityException

我的应用正在尝试访问设备的位置,并且我在AndroidManifest.xml中包含了以下内容:我已经按如下方式实现了GoogleApiClient.ConnectionCallbacks以访问位置服务:publicclassBackgroundLocationServiceimplementsGoogleApiClient.ConnectionCallbacks,GoogleApiClient.OnConnectionFailedListener{privatestaticfinalStringTAG=BackgroundLocationService.class.getSimple

android - 使 Fused Location Provider LocationClient 更易于使用

假设我的应用程序中有5个不同的Activity,它们希望使用LocationClient.getLastLocation()获取最后已知位置。这看起来很简单。理想情况下,我会在每个Activity中创建一个LocationClient并调用getLastLocation()。但是,连接到GooglePlay服务还需要做一些额外的工作,例如调用LocationClient.connect()并处理onConnected、onDisconnected和onConnectionFailed回调。文档在这里:https://developer.android.com/training/loca

android - ACCESS_FINE_LOCATION 在 list 中被授予,但总是被拒绝许可?

我目前正在尝试获取用户当前位置的纬度和经度。我在list中启用了以下权限。TargetSDK和minsdk都是23为此,我了解我需要对权限执行运行时检查。但是,当我执行以下操作时,我总是得到-1作为返回。(PERMISSION_DENIED)intpermissionCheck=ContextCompat.checkSelfPermission(getApplicationContext(),Manifest.permission.ACCESS_FINE_LOCATION);尝试访问当前位置时是否遗漏了一个步骤?完整代码在这里:privateStringgetZipcodeFromCu

android - 查找位置 : Google Play Location Service or Android platform location APIs

我正在尝试为我的新导航应用程序获取用户位置。我想经常检查用户的位置,它必须是准确的。我使用示例中的以下代码来获取位置。publicclassMainActivityextendsActivityimplementsLocationListener{privateLocationManagerlocationManager;privateStringprovider;privateTextViewa;privateTextViewb;@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInst