Background I/O Management...Service?

Put your problem here if it does not fit any of the other categories.

Background I/O Management...Service?

Postby wirelessdesigns » Thu Jun 10, 2010 8:27 pm

Hi all -

I'm working on an application that will maintain a connection to a serial device. The communication is asynchronous, in that sometimes data will be received on the port that the application must react to. The serial connection must be accessed from each of my Activities for a different reason, and I'm trying to figure out if I should be using a Service for this?

All I really need is a single interface that runs behind my application so I can queue up an outgoing command from any Activity and have it sent out the port, whilst also being able to react to any incoming data an manage it (wake the proper activity, make a notification, etc.).

If not using a Service, what would be a better design pattern?

Posts: 25
Joined: Fri Dec 18, 2009 3:27 pm
Location: Littleton, CO


Re: Background I/O Management...Service?

Postby fbarnard » Tue Jun 15, 2010 3:10 pm


You can start a intent(with intent filters in manifest) in the service with information about what happend or you can bradcast a message and catch it with a BroadcastReceiver . Service for the actual communication is most prob the right design. Like i said at the top there is diff ways of letting activity or component know what happend in service.
Posts: 44
Joined: Tue Jun 15, 2010 12:31 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 6 guests