android-developers
[Arriba] [Todas las Listas]

Re: [android-developers] Qué es el uso de servicios en Android?

To: Android Developers <android-developers@xxxxxxxxxxxxxxxx>
Subject: Re: [android-developers] Qué es el uso de servicios en Android?
From: Kristopher Micinski <krismicinski@xxxxxxxxx>
Date: Thu, 8 Aug 2013 14:08:18 -0400
Delivery-date: Thu, 08 Aug 2013 14:08:56 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=y/l6jTRuaq7F9vXZJH3gfdSfud/cx8MQOg5bRvEBlsQ=; b=kWe42aWG7G5cTGjKE61y0vgg9MR6OSGT91F+OH9y0j1dK/7rzpIaizZhlKNw/IjAP1 cuwzHtl4tBGQxBYOLXuynIuuwhZvg30M6Lt5aFwZP1VzPcu6LPtgtOFNjIQyiAz7v8AP qk8qHq1YFeYufVaRhgS8Lr4D61ITGxdFUTsE8ZKvRLlhDvNKsugvn7H4b+YHin0+zX43 mRSU6OvZ5dxBXUS4xdg5ZiwK3IBCwB2RxFoqHa/NCJGc8TjJuEG6uAFGxXOxp+MXIzJF ToEA9S05QHtrUllvqNlV/ISR47YxPgWLNPGXdUPDIOXPIRQo2hOhvZ1m6RvTJJQZtEpI GQvQ==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=y/l6jTRuaq7F9vXZJH3gfdSfud/cx8MQOg5bRvEBlsQ=; b=vKGU1BFqtzlEwvXJ3iznTvUUW+X1Fw6EHeGgnfSTLxUhX3e+9dZp+xBKQ14KVdTEqS KoCqLd9Y2AdUvrLVDAOSFFgOVrRetfPJN/WMeKD3yqYrJucRQKeFcGQYk4kjEzG9Lh/i 1fEjlzjtZ3ot5yJMZispuv5fwjp1Fy5MXn1ISoRCSUdVQ9t7x0Uoo9NKbymizgipizxN Ps5p44irxXGyv+FvI4YgH0lKkPOvMmMiOuM0z0nGbdTIDmPIpM4bh3wmARxzicuys5d9 xYGceg5XoJUnBn4uG04fIHWBglV62kwjnnHH07EOsUl8KLoT9T0ezMD8mXtQqzJ/udcS IkGw==
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <bf4f2db7-2f90-4026-baad-97be452aa56e@googlegroups.com>
List-archive: <http://groups.google.com/group/android-developers>
List-help: <http://groups.google.com/support/>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <http://groups.google.com/group/android-developers/post>, <mailto:android-developers@googlegroups.com>
List-subscribe: <http://groups.google.com/group/android-developers/subscribe>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <http://groups.google.com/group/android-developers/subscribe>, <mailto:googlegroups-manage+364598216046+unsubscribe@googlegroups.com>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
References: <caa3468f-3841-43fd-8208-34c99cb07758@googlegroups.com> <CAF1Sy-H864+OAHO4tHdp6tQiWSPMU6R-ncCTYETq60a_yCnYuQ@mail.gmail.com> <bf4f2db7-2f90-4026-baad-97be452aa56e@googlegroups.com>
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx
Envías un mensaje al servicio para parar el hilo.  Entonces el servicio
para el hilo, por poner alguna bandera o variable de condición.

*Kris


En *Thu, *Aug 8, 2013 en 2:04 PM, *ashish <ashish.acet@xxxxxxxxx> escribió:

> *Hi,
>
> si un servicio empieza un  hilo nuevo entonces cómo *i puede parar el servicio de la
> otra clase.
>
>
> En jueves, agosto 8, 2013 3:51:19 SOY *UTC-8, Kristopher *Micinski escribió:
>
>> Normalmente utilizas un servicio para coordinar un hilo.
>>
>> FYI la mayoría de el tiempo no quieres francamente matar un hilo (*e.*g., si
>> es aproximadamente para regresar de un descargar operación), quieres *periodically
>> comprobar una bandera.
>>
>> Probablemente no quieres utilizar hilos en su moda cruda (de actividades)
>> para unas cuantas razones, uno del cual ser que con cambios
>> de configuración son más delicados de conseguir correcto.  En cambio si necesitas trabajo de fondo
>> que cabe el modelo, un *AsyncTask es un *appropriate diseño.
>>
>> *Kris
>>
>>
>> En *Thu, *Aug 8, 2013 en 7:40 AM, *ashish <ashis...@xxxxxxxxx> escribió:
>>
>>> leí sobre servicios en *Android muy cuidadosamente, pero no encontré cualesquier
>>> razones válidas para utilizarlo. *E.*g.
>>>
>>>    1.
>>>
>>>    Por *default los servicios corridos en el hilo principal, el cual la mayoría de las
>>>    aplicaciones no quieren.
>>>    2.
>>>
>>>    Un servicio puede correr en un *seperate hilo si él *spawns lo hilo propio.
>>>    Pero si unas carreras de servicio en un *seprate hilo, entonces el método *stopService(nuevo
>>>    *Intent(*getApplicationContext()**, *MyService.Clase)); no para
>>>    el corriendo servicio. Otra vez esto es un problema.
>>>
>>> Si queremos hacer algunas operaciones de fondo, entonces pienso que los hilos son
>>> mejor que servicios. Soy yo bien?
>>>
>>> --
>>> Recibiste este mensaje porque eres *subscribed al *Google
>>> Grupos "*Android *Developers" grupo.
>>> A correo a este grupo, envía *email a *android-*d...@***googlegroups.*com
>>>
>>> A *unsubscribe de este grupo, envía *email a *android-*developers+**unsubscribe@xxxxxxxxxxxxxxxx
>>> 
>>> Puesto que más opciones, visita este grupo en
>>> *http://grupos.*google.*com/**Grupo/*android-*developers?*hl=*en<*http://Grupos.*google.*com/Grupo/*android-*developers?*hl=*en>
>>> ---
>>> Recibiste este mensaje porque eres *subscribed al *Google
>>> Grupos "*Android *Developers" grupo.
>>> A *unsubscribe de este grupo y la parón que recibe *emails de él, enviar
>>> un *email a *android-*developers+**unsubscribe@xxxxxxxxxxxxxxxx.
>>> Puesto que más opciones, visita *https://grupos.*google.*com/**Los Grupos/optan_fuera de *https://grupos.*google.*com/Los<Grupos/optan_fuera>
>>> .
>>>
>>>
>>>
>>
>>  --
> Recibiste este mensaje porque eres *subscribed al *Google
> Grupos "*Android *Developers" grupo.
> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
> 
> Puesto que más opciones, visita este grupo en
> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
> ---
> Recibiste este mensaje porque eres *subscribed al *Google Grupos
> "*Android *Developers" grupo.
> A *unsubscribe de este grupo y la parón que recibe *emails de él, enviar un
> *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx.
> Puesto que más opciones, visita *https://grupos.*google.*com/Los Grupos/optan_fuera.
>
>
>

-- 
Recibiste este mensaje porque eres *subscribed al *Google
Grupos "*Android *Developers" grupo.
A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx

Puesto que más opciones, visita este grupo en
*http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
--- 
Recibiste este mensaje porque eres *subscribed al *Google Grupos "*Android *Developers" grupo.
A *unsubscribe de este grupo y la parón que recibe *emails de él, enviar un *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx.
Puesto que más opciones, visita *https://grupos.*google.*com/Los Grupos/optan_fuera.
You send a message to the service to stop the thread.  Then the service
stops the thread, by setting some flag or condition variable.

Kris


On Thu, Aug 8, 2013 at 2:04 PM, ashish <ashish.acet@xxxxxxxxx> wrote:

> Hi,
>
> if a service starts a  new thread then how i can stop the service from the
> other class.
>
>
> On Thursday, August 8, 2013 3:51:19 AM UTC-8, Kristopher Micinski wrote:
>
>> Usually you use a service to coordinate a thread.
>>
>> FYI most of the time you don't want to outright kill a thread (e.g., if
>> it's about to return from a download operation), you want to periodically
>> check a flag.
>>
>> You probably don't want to use threads in their raw fashion (from
>> activities) for a few reasons, one of which being that with configuration
>> changes they're trickier to get right.  Instead if you need background work
>> that fits the model, an AsyncTask is an appropriate design.
>>
>> Kris
>>
>>
>> On Thu, Aug 8, 2013 at 7:40 AM, ashish <ashis...@xxxxxxxxx> wrote:
>>
>>> I read about services in Android very carefully, but I didn't find any
>>> valid reasons to use it. E.g.
>>>
>>>    1.
>>>
>>>    By default services run in the main thread, which most of the
>>>    applications don't want.
>>>    2.
>>>
>>>    A service can run on a seperate thread if it spawns it own thread.
>>>    But if a service runs on a seprate thread, then the method stopService(new
>>>    Intent(getApplicationContext()**, MyService.class)); does not stop
>>>    the running service. Again this is a problem.
>>>
>>> If we want to do some background operations, then I think threads are
>>> better than services. Am I right?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-d...@**googlegroups.com
>>>
>>> To unsubscribe from this group, send email to
>>> android-developers+**unsubscribe@xxxxxxxxxxxxxxxx
>>> For more options, visit this group at
>>> http://groups.google.com/**group/android-developers?hl=en<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 unsubscribe from this group and stop receiving emails from it, send
>>> an email to android-developers+**unsubscribe@xxxxxxxxxxxxxxxx.
>>> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>  --
> 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@xxxxxxxxxxxxxxxx
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscribe@xxxxxxxxxxxxxxxx.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@xxxxxxxxxxxxxxxx.
For more options, visit https://groups.google.com/groups/opt_out.
<Anterior por Tema] Tema Actual [Siguiente por Tema>