Android的:如何处理该申请是由HOME键最小化 [英] Android: How to handle that the application is minimized by HOME button
问题描述
这是问题已在几天前出现了。 我有听GPS定位的应用程序。侦听器是一个后台服务,工程所有的时间,这项服务将数据保存在应用层面和每个活动读取这些数据。所以,当我preSS后退按钮,我能够赶上这个活动,我可以停止服务,但是当我preSS HOME键的服务仍然工作尽管该应用程序在后台模式下,这会消耗电池,因为GPS总是工作。我该如何处理这个事件?我也想停止所有服务,当用户presses HOME按钮并重新启动它们,当用户回来。 10X
An issue has appeared a few days ago. I have an application that listen for GPS location. The listener is a background service that works all the time, this service saves data in application level and each activity reads this data. So, when i press back button i am able to catch this event and i can stop the service, but when i press HOME button the service is still working although the application is in background mode and this consumes battery, because the GPS always works. How can i handle this event? I do want to stop all services when the user presses HOME button and start them again when user gets back. 10x
推荐答案
在你的Android应用程序无法处理家庭按钮事件。谷歌已经仅供内部使用。
You can not handle home button events in your Android application. Google has made it for internal use only.
这篇关于Android的:如何处理该申请是由HOME键最小化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!