保存在Android的GPS服务消耗电池电量 [英] Save battery power consumed by gps services in android

查看:107
本文介绍了保存在Android的GPS服务消耗电池电量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发的有两个GPS服务的应用程序。其中一个是定位跟踪它在发送每2分钟位置更新到服务器,另一个服务cyberseatbelt其中检查设备的速度时,位置更新。

I am developing an application which has two GPS services. One of which is location tracking which send location updates at every 2 min to server and another service is cyberseatbelt which checks for speed of device when location updates.

使用这两种服务,电池消耗是我的手机显示的77%。如果没有这两个服务,无需电池消耗显示。

With these two services, battery consumption is 77% displayed in my mobile. Without these two services, no battery consumption is displaying.

有没有什么解决方案,以节省电池电源装置,同时保持所需的功能?

Is there any solution to save battery power on device while keeping the desired functionality?

推荐答案

您必须告诉你做了什么,使电池消耗如此之高。 (甚至没有清楚,如果电池后变成77%1分钟15分钟或1个小时)。

You have to tell what you have done to make the battery consumption so high. (Not even clear if battery becomes 77% after 1 minute or 15 minutes or 1 hr).

您是如何访问GPS?你运行一个处理器/线程定期轮询GPS。如果是的话,这是错误的做法。你可以问的Andr​​oid通知你的位置变化。

How are you accessing GPS? Are you running a handler/thread to periodically poll the GPS. If yes, this is wrong approach. You can ask Android to inform you on location changes.

GPS服务通常是存储器饿了。你需要GPS服务,或只是为了寻找位置更新?的Andr​​oid自带的基于位置服务的一个很好的启动DOCO。 <一href=\"http://developer.android.com/guide/topics/location/obtaining-user-location.html\">http://developer.android.com/guide/topics/location/obtaining-user-location.html
试试下面这个DOCO步骤找到最佳的用户的位置。

GPS services are usually memory hungry. Do you need GPS services or just looking for location updates? Android comes with a good startup doco for location based services . http://developer.android.com/guide/topics/location/obtaining-user-location.html Try following the steps in this doco to find best user location.

确认停止监听在适当的时候更新。用户不会高兴的是,一个应用程序试图排出,即使它没有运行电池。

Make sure to stop listening for updates at the appropriate time. Users will not be happy that one app tries to drain the battery even when it is not running.

尝试使应用程序作为后台任务..即服务或广播接收器

Try making the app as a background task.. i.e a Service or BroadcastReceiver

这篇关于保存在Android的GPS服务消耗电池电量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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