当我们在FusedLocationClient中为LocationRequest设置间隔并设置最小位移时会发生什么?

问题描述 投票:0回答:1

我正在将LocationRequest用于FusedLocationClient,并将setInterval设置为30秒,并将setSmallestDisplacement设置为10m。现在,我的代码会在30秒内或超过10米时通知位置吗?

android location fusedlocationproviderapi
1个回答
0
投票

对位移赋予的权重大于对间隔的权重。因此,例如,如果您将最小位移设置为10m,间隔设置为30秒,那么如果没有任何位移,则不会接收到任何位置更新。如果没有设置位移并且将间隔设置为30秒,则每30秒将接收到位置更新。

© www.soinside.com 2019 - 2024. All rights reserved.