Battery life if using GPS and background app ios/android

▼魔方 西西 提交于 2019-12-08 19:10:40
Lucifer

It looks like we worked on same requirement. My code sends GPS location to server on regular interval ( say 1 min, 5 min, 15 min... as per user requirement ) untill now my code was like it constantly open the GPS so battery life was very few hours like 3-4 hours ( when device/phone is full charged ).

After searching on Stack Overflow i come to this answer. Now to solve battery issue i again re-design the application in such a way that GPS start when application is going to upload the data and stops in 30 seconds.

Also I change code from TimerTask Class to AlarmManger class so it users much lesser memory.

After these changes my application works 10 hours for 1 min interval ( when phone is full charge ) and so on.

Normally battery life is 20 hours, and no interval is set like that it can extends that period, so i got optimum level like 2 minutes.

Or only turn on the GPS (Is this doable with iOS &or Android?) whenever its after 5pm each day so that it will minimize the load on the battery?!?

I suggest you to look AlarmManager class's example. It would be the best solution for you. your application will be very light weighted.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!