why should i use android service instead of java thread

后端 未结 7 2058
遥遥无期
遥遥无期 2021-02-02 12:56

I am confused with android services and java thread.

Please help me to understand in which scenario i should use them.

As per my understanding

7条回答
  •  不知归路
    2021-02-02 13:28

    Always: A service of your application is usable not only by other components of your application, but by other applications, too.

    A service is for use in not-GUI parts of program.

    Mostly: A service is something more independent, than a thread. Service is something more long-living than a thread. Service is something more complex than a thread.

    BTW, threads do not run in background only. What runs in foreground, is a thread, too.

提交回复
热议问题