Service or Bound Service?

后端 未结 3 1592
粉色の甜心
粉色の甜心 2020-12-29 09:27

I\'m creating an application that connects to an XMPP server on Android. I want to keep the connection on till the user logs out.

Should I use a regular Service or a

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 09:59

    I found out the difference between the two and when to use it. If you want to interact with the service (for example send arguments etc), use bound service and it return the service object in the onServiceConnected method (where you can call methods in the service). You cannot interact with a regular service (from another class)

提交回复
热议问题