gpt4 book ai didi

android - API 级别 26 中的 android 后台服务超时

转载 作者:太空狗 更新时间:2023-10-29 14:40:19 25 4
gpt4 key购买 nike

Android Oreo 对后台服务引入了新的限制。doc

"While an app is in the foreground, it can create and run both foreground and background services freely. When an app goes into the background, it has a window of several minutes in which it is still allowed to create and use services. At the end of that window, the app is considered to be idle."

(重点是我加的)

几分钟”是多长时间?

最佳答案

将您的应用定义为启动器并替换设备的默认启动器(停用它)。如果启动器崩溃,系统将自动重新启动它。由于启动器将成为您的应用,因此它会自动重启

在您的 list 中添加(如 explained here ):

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- The following two intent-filters are the key to set homescreen -->
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />

</intent-filter>

关于android - API 级别 26 中的 android 后台服务超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49254017/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com