简体   繁体   English

用于跟踪用户位置的高效后台服务

[英]Efficient Background service for tracking user location

I am developing a small android application in which I want to have Geolocation functionality. 我正在开发一个小型Android应用程序,我希望在其中具有Geolocation功能。 What I want to code is one service which gives the updated location of a user whether they are using my application or not. 我想要编码的是一种服务,它提供用户的更新位置,无论他们是否正在使用我的应用程序。

I know that if I am continuously checking the user's location it will drain the battery of the device, so I want good solution for that. 我知道,如果我不断检查用户的位置,它会耗尽设备的电池,所以我想要很好的解决方案。 For example, to give me updates every 5 or 10 minutes. 例如,每隔5或10分钟给我更新一次。 I have read about this question a lot but I wanted to get one good solution. 我已经阅读了很多这个问题,但我想得到一个好的解决方案。

I read this page and it's a good solution if the user is using my application but if the user not using my application then what should I do? 我读了这个页面 ,如果用户正在使用我的应用程序,但如果用户没有使用我的应用程序那么这是一个很好的解决方案,那么我该怎么办? How do I solve this challenge? 我该如何解决这一挑战?

Previously i have developed such kind of application. 以前我开发过这种应用程序。 with respect to your requirement, you will be require following APIs from Android. 根据您的要求,您将需要Android的以下API。

  • Location ( for Lat-lon information ) 位置 (Lat-lon信息)
  • AlarmManager ( to schedule an event to fetch lat-lon details on regular basis & upload data to remote server ) AlarmManager (安排事件定期获取lat-lon详细信息并将数据上传到远程服务器)
  • Http ( an API to send lat-lon details to remote server ) Http(用于向远程服务器发送lat-lon详细信息的API)
  • Android Service ( will allow to work in background ) Android服务(允许在后台工作)
  • BroadcastReceiver ( additional , if you wan to start your application automatically on device boot ) BroadcastReceiver(另外,如果您想在设备启动时自动启动应用程序)

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

相关问题 用于地理位置跟踪的前台或后台服务 - Foreground or background service for geo location tracking 在Android的后台服务中进行用户跟踪和数据发送 - User tracking and data sending in a background service in Android 服务无法在连续的后台位置跟踪中运行 - Service doesn't run on continuous background location tracking 在后台跟踪位置 - Tracking location in the background 使用PhoneGap在后台进行位置跟踪 - Location tracking in background with PhoneGap 当用户更改应用程序或活动/片段时,继续跟踪服务中的位置 - Continue tracking location in a service when user changes app or activity/fragment 跟踪用户位置的前台或后台服务? - Foreground or Background service to track user's location? 跟踪用户位置 - Tracking user location 最节能的位置跟踪实现? 意图/广播接收器/ LocationListener的/服务/ IntentService / AlarmManager? - Most power efficient location tracking implementation? Intent/BroadcastReceiver/LocationListener/Service/IntentService/AlarmManager? 开启时在后台进行位置跟踪在Android中更改位置 - Location tracking in background while onChanging of the location in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM