Keep应用在后台运行
问题描述:
我做这保持清醒的屏幕的应用程序,直到它被系统终止它工作正常。
我怎样才能让我的应用程序运行在后台?
我看到很多的应用程序使用通知保持运行,避免被杀害,但我不知道如何实现它。
有人可以帮助我实现这一目标?
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对于这一点,特别是 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.