运行多个服务实例

时间:2014-04-07 10:19:26

标签: android android-service android-lifecycle

是否可以多次启动服务。意味着多次调用startService。我知道如果我拨打startService,则会拨打onCreate() -> onStartCommand()。在startService上,它只调用onStartCommand()而不调用onCreate()。服务会怎样?它是否创建了多个服务实例?

1 个答案:

答案 0 :(得分:5)

不,服务只会在一个实例中运行。但是,每次启动服务时,都会调用onStartCommand()方法。看看this documentation

相关问题