日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

运行android程序时显示stop,Android系统.应用程序关闭时WorkManager是否正在运行?

發布時間:2025/3/12 Android 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 运行android程序时显示stop,Android系统.应用程序关闭时WorkManager是否正在运行? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我想安排每晚數據庫更新.所以我使用新的Android WorkManager.我的理解是,一旦安排它將始終獨立于應用程序的生命周期在后臺運行.

是對的嗎?我的第一次測試顯示Work只在應用程序運行時執行.

val locationWork = PeriodicWorkRequest.Builder(UpdateDatabaseWorker::class.java, 24, TimeUnit.HOURS)

.addTag("DATABASE_UPDATE_SERVICE")

.build()

WorkManager.getInstance().enqueue(locationWork)

解決方法:

根據WorkManager bugtracker上報告的各種問題,他們的文檔并不完全準確地說明了在這種邊緣情況下WorkManager的確切行為.

On certain devices, apps are force stopped when the app is cleared from task manager, so that part is expected. … 07001

Unfortunately, some devices implement killing the app from the recents menu as a force stop. Stock Android does not do this. When an app is force stopped, it cannot execute jobs, receive alarms or broadcasts, etc. So unfortunately, it’s infeasible for us to address it – the problem lies in the OS and there is no workaround. 07002

The only issue that we have come across is the case where some Chinese OEMs treat swipe to dismiss from Recents as a force stop. When that happens, WorkManager will reschedule all pending jobs, next time the app starts up. Given that this is a CDD violation, there is not much more that WorkManager can do given its a client library. 07003

To add to this, if a device manufacturer has decided to modify stock Android to force-stop the app, WorkManager will stop working (as will JobScheduler, alarms, broadcast receivers, etc.). There is no way to work around this. Some device manufacturers do this, unfortunately, so in those cases WorkManager will stop working until the next time the app is launched. 07003

通過對具有庫存android的Pixel 2 XL進行強烈的OneTimeWorkRequest(無約束)測試,行為如下:

>任務經理關閉:

>工作繼續(稍后)

>重啟設備(正常運行):

>重啟完成后繼續工作

>應用信息“強制停止”:

>工作停止,只有在再次啟動應用程序時才會繼續

>重啟設備(工作是“強制停止”):

>在應用再次啟動之前,工作不會繼續

總結

以上是生活随笔為你收集整理的运行android程序时显示stop,Android系统.应用程序关闭时WorkManager是否正在运行?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。