Service或IntentService哪种方法最适合与android中的服务器保持活动会话

0 service session android keep-alive intentservice

我想通过套接字保持与服务器的连接。这种情况下哪一种更好?服务还是IntentService?为什么?

Sof*_*oud 5

您必须使用服务,因为它会一直有效直到您停止它。另一方面,IntentService在无法工作时会自行停止。