在Android的后台位置跟踪 [英] Location tracking in background in android

查看:239
本文介绍了在Android的后台位置跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作而取以周期方式的详细位置信息的应用程序..
我已经尝试的服务和broadcastreciever,但未能实现在特定的时间框架的位置的详细信息说30分钟左右。可任何帮助或建议我一些事情的经过,我可以一次又一次地实现了位置的详细信息...
在进阶Thnks

I am working on an application which fetch the location details in a periodic manner.. i have tried service and broadcastreciever but failed to achieve the location details in particular time frame say 30mins or so.. can any help or suggest me some thing through which i can achieve the location details again and again .. Thnks in adv

推荐答案

您是否尝试过使用报警管理?
你可以做到以下几点更新周期性位置:

Have you tried using the Alarm Manager? You can do the following to update location periodically:

1.注册报警管理器,将调用一个服务,每30分钟一班。

1.Register an alarm manager that will call a service every 30 mins.

2.确保使该设备从睡眠中唤醒你获得一种唤醒锁。

2.Make sure you acquire a wake lock so that the device wakes up from sleep.

3,报警管理器将挂起的意图依次调用当警报被触发BroadcastReciever /服务。

3.The alarm manager takes a pending intent which in turn calls a BroadcastReciever/Service when the alarm is triggered.

4.从这个BroadCastReciever致电服务到将更新您的位置。
<一href=\"http://stackoverflow.com/questions/2775628/android-how-to-periodically-send-location-to-a-server\">Check这个问题的完整code。 <一个href=\"http://stackoverflow.com/questions/9407309/send-current-location-to-server-periodically-in-android\">Also这一点。

4.From this BroadCastReciever call the Service to that will update your location. Check this question for the complete code.Also this.

这篇关于在Android的后台位置跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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