Tuesday, November 9, 2010

[android-developers] Re: Controlling a service

On 10 Nov, 00:58, Mark Murphy <mmur...@commonsware.com> wrote:
> On Tue, Nov 9, 2010 at 6:52 PM, Federico Paolinelli <fedep...@gmail.com> wrote:
> > And a more general question: is the bind mechanism suitable for one
> > shot services, or it just make sense for persistent services?
>
> To me, that is a bit like asking if a wheel is suitable for bananas,
> or does it just make sense for apples. :-)

:-((

>
> Bind if:
>
> -- You are going to be around for the duration of the operation
> -- The service needs to be around
> -- You need a rich API
>
> For example, if you have a Service that is providing a local API
> around a synchronous Web service, binding is a fine solution.
>

I think it still depends on how many calls you are going to do. I
mean, even in case of a synchronous web service, this may be
implemented with an intent service (with the overhead of the
conversion to intents back and forward for the query parameters and
the result). In this way you can still save resources.

What keeps bugging me is that you never really __need__ to be around,
but on the other hand my laziness pushed to the rich api solution.


> > What happens if I call the startService method but the service is
> > already active? Will it start another service, or will it call the
> > onStartCommand of the same service?
>
> The latter. There cannot be more than one copy of a service running at a time.
>
> --


Thanks as always,

Federico

--
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