【问题标题】:Retrieving location every 5 seconds每 5 秒检索一次位置
【发布时间】:2016-09-26 11:09:44
【问题描述】:

您好,我正在创建一个项目。这是关于跟踪司机。驱动程序必须每 5 秒将其位置信息发送到 Firebase。我的问题是乘客如何每 5 秒检索一次司机的位置。

【问题讨论】:

标签: android google-maps firebase


【解决方案1】:

简而言之:

LocationRequest locationrequest = LocationRequest.create();
locationrequest.setInterval(5000);   // 5 seconds
LocationClient locationclient = new LocationClient(this, this, this);
locationclient.requestLocationUpdates(locationrequest, this);

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

在此链接中,建议您使用新的Google Play services location APIs。但他们的想法是一样的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-21
    • 1970-01-01
    • 2020-01-08
    相关资源
    最近更新 更多