1

I don't know which of these methods are suited for my needs. I need to add a background service to my application that

  1. Opens a server socket
  2. Wait for a socket connection from a client
  3. Once socket connection is made, indefinitely listen for messages sent through the client

The application has no activities and is essentially 2 services (1 that exists for something else, and 1 that I described above)

Should I extend service or intent service? I assume I'll need to make threads within either of the classes as to not block other code execution in the other service?

Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
user3369427
  • 425
  • 6
  • 14

1 Answers1

0

You said:

2) Wait for a socket connection from a client 3) Once socket connection is made, indefinitely listen for messages sent through the client.

It's better for you to extend Service for this operation. IntentService is a service class which can't handles waiting task, but Service can handles it. IntentService always do its job impatiently.

Anggrayudi H
  • 14,977
  • 11
  • 54
  • 87