简体   繁体   English

跟踪在Android中某个位置花费的时间

[英]Tracking time spent at a location in Android

Maybe I haven't been googling the right thing, but I am trying to figure out how to track the time a user spends at a particular location. 也许我没有一直在研究正确的事情,但是我试图弄清楚如何跟踪用户在特定位置花费的时间。 I did some research , and I found that I could use the Geofencing API to define a Geofence location and then fire off an IntentService when the user's current location is within the Geofence. 我做了一些研究 ,发现可以使用Geofencing API定义Geofence位置,然后在用户的当前位置在Geofence内时触发IntentService。 How do I begin to track the time spent at this location? 我如何开始跟踪在此位置花费的时间? Any insights/comments/tutorials/sample code would be most appreciated! 任何见解/评论/教程/示例代码将不胜感激!

I don't have much idea here, but I think there is a LocationListener that listens for updates on change in device's location. 我在这里没有太多想法,但我认为这里有一个LocationListener,用于侦听设备位置更改的更新。

You can compute time between consequent location updates to find the time spent at the most recent location. 您可以计算后续位置更新之间的时间,以找到在最新位置花费的时间。

For details, you can go through LocationListener/LocationManager documentation on developer.android.com. 有关详细信息,您可以浏览developer.android.com上的LocationListener / LocationManager文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM