简体   繁体   English

我应该使用哪种类型的服务进行数据迁移?

[英]Which type of service should I use for data migration?

I need to migrate my app data in order to use Scoped Storage.我需要迁移我的应用数据才能使用 Scoped Storage。 I would like to do it in a service, so it's transparent for the user.我想在服务中做到这一点,所以它对用户来说是透明的。 The service will be launched when the user opens the app for first time after the update.该服务将在用户更新后首次打开应用程序时启动。

But I don't know which type of service would be best.但我不知道哪种类型的服务最好。 A plain Service will be enough?一个简单的服务就足够了吗? Which limitations does it have?它有哪些限制? Do I need a foreground service?我需要前台服务吗? JobIntentService?工作意向服务? WorkManager?工作经理?

Plain service that is a foreground service would probably be the best option but you could also use a one time WorkManager task since they can also start a foreground service作为前台服务的普通服务可能是最佳选择,但您也可以使用一次性 WorkManager 任务,因为它们也可以启动前台服务

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

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