问题标签 [android-fusedlocation]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1193 浏览

android - 如何在 onMapReady 方法中访问我在 onLocationChanged 中的当前位置?

我试图在 onMapReady 方法中的 onLocationChanged 方法中访问我的当前位置,但 currentlatlng 返回 null。任何指导都会有所帮助。

这是代码:

也许我错过了一些非常简单的东西。先感谢您。

0 投票
1 回答
2210 浏览

xamarin - FusedLocation GoogleApi - 侦听器不得为空 (Xamarin.Android)

我得到以下信息:

Java.Lang.NullPointerException:监听器不能为空。

似乎无法摆脱它。我已经用尽了我能找到的所有可能的解决方案。

看来问题出在方法上setGoogleApiClient();

检查此图像:

在此处输入图像描述

发现错误后我点击继续:

0 投票
1 回答
1259 浏览

xamarin - Android - Xamarin - Fused Location

I am trying to implement a custom activity that initialises the Fused Location services in Xamarin c# so I can reuse this activity whenever the Fused Location is needed. The problem that I am having is that the map is being loaded before the location services. This way, I cannot animate the camera to zoom in at the user's location since the location is still null.

Here is the custom activity:

Here is the class that inherit the custom class:

Here is the fragment in the inherited activity:

I was thinking of implementing a call back to LocationTrackerActivity. So when the location services become available the class MapActivity then would be able to load the MapViewFragment within that custom callback. This way the location services would be loaded before the map. Therefore, this part of the code would always execute :

However I have no idea how to customise a callback. Maybe there are better solutions to this problem?

0 投票
2 回答
2297 浏览

android - 禁用后虚假 GPS 位置仍然存在

在我们的 Android 应用上,我们需要检测用户何时向我们提供虚假位置。一旦我们禁用了虚假位置应用程序(“Fake GPS”),Fused Location Provider 就会继续向我们发送旧位置,但上面没有模拟位置密钥。

这是一个已知的错误?有什么方法可以检测这些新位置是否来自虚假提供商?

我们正在使用带有 6.0.1 的 Nexus 6P 进行测试

0 投票
4 回答
6550 浏览

android - Android:关闭位置时,Google Fused Location 不起作用

getLastLocation()在我的 6.0 Nexus 7 平板电脑上关闭手机位置时返回 NULL,但它在另一台设备上没有 GPS 的情况下工作。为什么会这样以及有什么方法可以解决它?我想关闭 GPS,只使用网络获取位置。

下面是我用来获取位置的类:

0 投票
1 回答
1358 浏览

android - 屏幕关闭时不会出现Android后台位置更新

我们正在开发移动跟踪应用程序。对于位置更新,使用融合位置 API 并以高精度为优先。

即使屏幕关闭,也需要更新位置。所以,我们正在使用背景Service。背景Service也正在获取部分WakeLock,因此设备不会进入睡眠状态。在后台Service,我们请求位置更新以及Service.

问题是我们只在屏幕打开时接收位置更新。一旦屏幕关闭,位置更新就会停止。还有一个Thread运行,Service它在任何时候都不会被杀死。

当屏幕关闭时再次创建位置请求BroadcastReceiver也不起作用。

这是背景Service类(RouteExecution):

Service开始使用AlarmManager. 这是提取:

BroadcastReceiver

即使屏幕关闭,如何继续获取位置更新。

谢谢您的帮助。

0 投票
0 回答
154 浏览

android - 无法在没有 Gps 的情况下使用 FusedLocationApi 获取当前位置

我正在尝试使用以下代码使用 FusedLocationApi 获取用户当前位置。我正在遵循此处提供的指南:https ://developer.android.com/training/location/retrieve-current.html

到目前为止,我已经尝试过:

我获得了启用 gps 的位置,但是一旦我禁用 gps,mLastLocation 总是返回 null。不使用 Gps 就不能从 FusedLocationApi 获取位置吗?请帮忙!!

0 投票
2 回答
641 浏览

android - 具有融合位置的地理围栏

我正在开发一个应用程序,我必须在其中进行地理围栏,但融合位置可能是也可能不是 GPS 信号可用。

通过可用的地理围栏示例,它显示当 gps 关闭时,地理围栏服务现在不可用。

https://developer.android.com/training/location/geofencing.html

我想从地理围栏的融合位置获取位置。可能吗?

0 投票
3 回答
2543 浏览

java - Android服务不更新位置

我需要每 1 分钟和每 5 米位移更新一次融合位置(我知道这是不好的做法,但为了测试和在 Log 中显示),我通过按钮开始服务按下按钮后立即按下我在 logcat 中的位置但是只有一次。根据服务类onLocationChanged应该每 1 分钟调用一次,但即使我的 GPS 几乎每分钟打开一次,然后在一段时间后关闭,但 Logcat 中仍然没有位置更新,它也不会再次调用。我需要服务类来保持更新位置而不影响UI 或主线程

这是logcat,它只显示一次位置更新

这是我的服务类

0 投票
3 回答
347 浏览

android - 当应用程序和设备中的 Google Play 服务不同时,使用融合位置获取 CurrentLocation 0

我正在尝试使用 Fusedlocationservice 获取当前位置。

在我的 gradle 文件中,我把 playservice 版本放在下面

现在,如果设备中有最新版本的 google playservice,那么它运行良好。它给出了适当的位置。

但是,如果设备的版本较低,则它不会给出当前位置。

它还在 logcat 中给出警告,如下所示:

因此,必须在设备中安装最新版本的 playservice 才能获取当前位置..?

如果是,那么我需要为此使用备用网络解决方案。因为每个用户都无法更新设备中的服务。

我的代码你可以在这里看到。获取棉花糖中的当前位置 0,其中 23 API 以下使用融合位置给出准确的当前位置

任何帮助将不胜感激。