简体   繁体   English

即使应用程序不在主要焦点中,是否可以在后台应用程序中运行计时器?

[英]Is it possible to make a timer run in the background app even if the app is not in main focus?

我希望我的计时器在应用程序本身的后面继续运行,当用户重新打开应用程序时,它将直接进入该活动,而计时器仍在运行

You probably want to implement a Local Service.您可能想要实现本地服务。 The usage is documented here: https://developer.android.com/reference/android/app/Service.html用法记录在此处: https : //developer.android.com/reference/android/app/Service.html

通过使用服务类并绑定服务,以便您可以在后台直到您结束服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM