Keep应用在后台运行 [英] Keep app running in background
问题描述
我做这保持清醒的屏幕的应用程序,直到它被系统终止它工作正常。
我怎样才能让我的应用程序运行在后台?
我看到很多的应用程序使用通知保持运行,避免被杀害,但我不知道如何实现它。
有人可以帮助我实现这一目标?
i made an application which keep the screen awake, and it works fine until it gets killed by the system. How can i keep my app running in background? I see a lot of apps that uses notifications to stay running and avoid being killed, but i don't know how to implement it. Can someone help me achieve this?
推荐答案
您可以使用的服务 API对于这一点,特别是<一个href=\"http://developer.android.com/reference/android/app/Service.html#startForeground%28int,%20android.app.Notification%29\"相对=nofollow> startForeground(INT,通知)函数调用。还有,我已经联系到API文档中提供的例子。
You can use the Service API for this, specifically the startForeground(int, Notification) function call. There is an example provided in the API documentation that I have linked to.
这篇关于Keep应用在后台运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!