Android的后台服务和警报 [英] Android background services and alarms

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

问题描述

最近遇到一个问题,当 Android 4.4系统杀了我的应用程序的服务 AlarmManager 当设备进入睡眠模式( START_STICKY 参数没有帮助)。我尝试了很多东西,但没有工作,因为我需要。

Recently encountered with a problem when Android 4.4 killed my app's Service and AlarmManager when device going into a sleep mode (START_STICKY param doesn't helps). I tried a lot of things, but nothing works as I need.

在我的任务管理器应用程序,我总是看到很多的非默认的应用程序,如谷歌+ Skype的过程中,谷歌驱动端还有一些实时的工作,从来没有被系统被杀害了。

In my task manager app I always see a lot of processes of non-default apps such as Google+, Skype, Google Drive end some else that working in real time and never were killed by the system.

我想问问有经验的开发人员如何创建服务警报不会被系统杀死或者这是一些安卓组件不可能?

I want to ask more experienced developers how to create Service or Alarm that will not be killed by the system or this is impossible on some Android assemblies?

推荐答案

这是不是一种编程的回答,因为不工作的原因,是不是在你的code。我stumpled约两个过前两周。我的服务八方通停止,我永远无法理解为什么,直到我发现了节能选项里面的设置(我的设备华为Ascend伴侣7)浏览:

This is not a kind of programming answer, because the reason of not working is not inside Your code. I stumpled about that too before two weeks. My service allways stopped and I never understood why, until I detected the "Power Saving" Option inside the settings (my device Huawei Ascend Mate 7) Navigate:

设置 - >省电 - >在顶部电源信息 - >保持屏幕关闭后运行

Settings --> Power Saving --> on the top Power Info --> keep running after screen off.

在这里,您可以启用或禁用应用程序,应该在后台运行,如果屏幕进入睡眠状态。

Here You can enable or disable apps, that should run in the background if the screen goes to sleep.

此外,如果它是不正确的答案,It's太长评论,也许它可以帮助其他人解决这个问题。

Also if it is not the correct answer, It´s too long for a comment, and maybe it helps others with this problem.

这篇关于Android的后台服务和警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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