仅在移动时使用fusedApi更新Android位置 [英] Android location update with fusedApi, only if am moving

查看:90
本文介绍了仅在移动时使用fusedApi更新Android位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取每1000米的位置更新信息,即仅在移动时进行更新,并具有融合的api集成功能.

How to get location update for every 1000 meter,ie update only if am moving ,with fused api integration.

推荐答案

在构建要由FusedLocationApi使用的LocationRequest时,可以使用setSmallestDisplacement(...) https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#setSmallestDisplacement(float)"rel =" nofollow>文档,如下所示:

When you are building your LocationRequest to be used by the FusedLocationApi you can use the method setSmallestDisplacement(...) as specified in the documentation like below:

locationRequest.setSmallestDisplacement(1000);

请注意,参数以米为单位.

Note that the argument is in meters.

这篇关于仅在移动时使用fusedApi更新Android位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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