Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Funcionamento de IntentService

Oi Silvio,

Isso mesmo !
Acabei de testar  aqui com o código abaixo.
Pelo visto, ele enfileira as requisições de IntentService e executa sequencialmente tipo fila.
A documentação fala em  "work queue processor" , deve ser isso então. Mas como conhecia pouco sobre, não havia entendido bem.
Valeu !!

// MainActivity
Intent serviceOne = new Intent(this, SimpleIntentService.class);
serviceOne.putExtra(SimpleIntentService.PARAM_IN_MSG, "one");
startService(serviceOne);
Intent serviceTwo = new Intent(this, SimpleIntentService.class);
serviceTwo.putExtra(SimpleIntentService.PARAM_IN_MSG, "two");
startService(serviceTwo);

// SimpleIntentService.onHandleIntent()
String msg = intent.getStringExtra(PARAM_IN_MSG);
Log.i("IntentService", msg);

// Resultado
one
two


2013/4/25 Silvio Gustavo <sgosantos@gmail.com>
Gink,

O serviço será iniciado uma única vez e os Intents serão processados sequencialmente em background pelo IntentService.

Abs,


On Wed, Apr 24, 2013 at 6:38 PM, Gink Labrev <gink.labrev@gmail.com> wrote:
Pessoal,

Se fizer isso:

Intent intentService = new Intent(context, TesteIntentService.class);
intent.putExtra("extra", extra01);
context.startService(intentService);

Intent intentService = new Intent(context, TesteIntentService.class);
intent.putExtra("extra", extra02);
context.startService(intentService);


O que ocorrerá ? Haverá duas instâncias do serviço ??

Abs,

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Silvio Gustavo de Oliveira Santos
Engenheiro de Software

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário