Android 位置:ProximityAlert
对于我的应用程序,我需要类似接近警报的东西,它通过调用以下命令注册到 LocationManager
:
public void addProximityAlert (double latitude, double longitude, float radius, long, expiration, PendingIntent intent);
如果屏幕关闭,此默认警报仅每 4 分钟触发一次。对于我的应用程序,有必要仅通过 NetworkProvider 请求位置更新,并且大约每分钟一次。
是否可以自定义默认设置,或者我是否必须通过像我想要的那样请求更新来创建自己的警报?
提前致谢, 乔纳森
for my app, I need something like a proximity alert, which is registered to LocationManager
by calling:
public void addProximityAlert (double latitude, double longitude, float radius, long, expiration, PendingIntent intent);
This default alert does fire only every 4 minutes if the screen is turned off. For my app, it is necessary to request location updates only via NetworkProvider
and about every minute.
Is it possible to custimize the default settings, or do I have to create my own alert by requesting updates like I want it to?
Thanks in advance,
Jonathan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 addProximityAlert 在内部使用两个提供程序(网络以及 GPS)并且您无法指定这些提供程序,因此我看不到配置此方法的方法。
requestLocation 更新可与仅网络提供商一起使用,然后您可以使用 Haversine 公式< /a> 计算距离差。
requestLocation 更新指出,不建议使用低于 60000ms 的值!
Since the addProximityAlert uses both the providers internally (network as well as gps) and you cannot specify these, I don't see a way to configure this method.
The requestLocation updates can be used with network only provider and then you can use the Haversine formula to calculate the distance difference.
The requestLocation updates states that values under 60000ms are not recommended though !