Friday, May 25, 2012

Re: [android-developers] Which is better, one trigger receiver and multiple services -- or -- one trigger receiver per service.

These are running in the same process.
I need 5, because they all do different tasks, and are quite independent of each other.


On Friday, May 25, 2012 5:20:15 PM UTC+5:30, James Black wrote:

Are these running in the same process as the main activity or remotely?

But, it seems that you are asking if you should have five separate services and simpler logic or slightly more complex in one.

Unless sufficiently complex I would go with one service and see later if more are needed.

On May 25, 2012 1:15 AM, "Put_tiMe" <puttime@gmail.com> wrote:
I have a situation where in I need to have 5 or more services running in the same package.
Let's call it service "A", "B", "C", "D" and "E"

Which is a better way of doing this? Better in terms of memory and CPU usage (and hence battery usage and efficiency).

1. Have 1 main service running, apart from the 5 mentioned above.
    Have only one trigger receiver and a the main service is linked with this trigger receiver.
    This will listen to all intents that are required.
    When an intent goes off, then we check if "A" needs this intent. If it needs, then we call startService("A", intent);
    Same with the other 4 services.

2. Have 1 trigger receiver linked with each of the 5 services.
    Handle intents 1 on 1 basis.


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate