Android: Which Background Service to use?

萝らか妹 提交于 2019-12-02 11:34:41

问题


I have an app where a user can perform a backup (offline) and restore (offline) on a button click. However, i don't know which background service is appropriate to use. Can someone advise me whether to use WorkerManager or Service in this case?


回答1:


I recommend you to use ForegroundService as of the goal of using these services are Long Running Processes that Users should be informed and interact with it .

Consider when you try to backup when you Use ForegroundService then you can show to user

  • The process left to end
  • Cancel Backup
  • Pause
  • and etc

So I recommend you to use this approach .



来源:https://stackoverflow.com/questions/57075329/android-which-background-service-to-use

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!