Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Notificação abre nova instância da Activity na pilha

Tenta usar na declaração da sua Activity no Manifest:

android:launchMode="singleTask"



2014-03-18 21:16 GMT-03:00 Gink Labrev <gink.labrev@gmail.com>:
Sim, obviamente.

Removi o launch mode e tentei o FLAG_ACTIVITY_SINGLE_TOP.

Iniciou uma nova activity na pilha. Ficou Activity A -> Activity A.

Existe alguma condição para que o flag possa não funcionar ?
O código é o mesmíssimo que o da documentação ...


Em 18 de março de 2014 20:08, Rodrigo Piovezan <piovezan@gmail.com> escreveu:

Uma última tentativa, usar somente FLAG_ACTIVITY_SINGLE_TOP não resolve?


2014-03-18 19:42 GMT-03:00 Gink Labrev <gink.labrev@gmail.com>:

Quer dizer, "resolvido" está, usando o launch mode.
Mas eu realmente acho mais elegante a solução por Intent.


Em 18 de março de 2014 19:41, Gink Labrev <gink.labrev@gmail.com> escreveu:

Andre, 

Valeu. Mas usei essa flag e não resolveu.
Não sei porque não funciona.


Em 18 de março de 2014 10:03, Andre Souza <deh.osouza@gmail.com> escreveu:

Cara, dá uma olhada na documentação: http://developer.android.com/reference/android/content/Intent.html

Mas se vc tá querendo restaurar uma activity já anteriormente aberta, basta usar: FLAG_ACTIVITY_REORDER_TO_FRONT


Em 18 de março de 2014 04:48, Gink Labrev <gink.labrev@gmail.com> escreveu:

Alguém sabe os detalhes ? O que signifca exatamente aquela combinação de flags ?

E porque ao ser acionada, aloca uma nova Activity na pilha ao entrar na app, ao invés do comportamento esperado de entrar na que já está em execução ?


Em 18 de março de 2014 04:45, Gink Labrev <gink.labrev@gmail.com> escreveu:

Então Rodrigo,

Valeu. Mas estava usando a seguinte flag

resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

E funcionava bem, retornando a Activity em execução quando clicasse na notificação.
Porém inicia uma nova Activity quando clicasse no ícone da app na tela de Aplicações (ficando Activity A -> Activity A).

Comportamento estranho, não ?


Em 16 de março de 2014 17:52, Rodrigo Piovezan <piovezan@gmail.com> escreveu:

Dá uma lida na seção "Using Intent flags" da página Tasks and the Back Stack da documentação do Android. Se não me engano dá pra passar certas flags ao intent da notificação que permitem abrir a activity atual sem criar uma nova.


2014-03-16 12:24 GMT-03:00 Gink Labrev <gink.labrev@gmail.com>:
Pessoal,

Implementei uma notificação conforme documentação do Android [1] e notei que, ao invés de levar a Activity existente, criava uma nova. Ao clicar na notificação, a pilha ficava assim:

Activity A -> Activity A

A solução que encontrei foi deixar o Launch Mode como SingleTop [2].

É a melhor solução ? Não sei se é recomendável alterar este tipo de configuraçã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/d/optout.

--
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/d/optout.


--
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/d/optout.



--
André Luiz de Oliveira Souza
Engenheiro da Computação
Pós-graduado em Desenvolvimento de Software com ênfase em Java Corporativo

--
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/d/optout.


--
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/d/optout.

--
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/d/optout.

--
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/d/optout.



--
Paz e Bem
Felipe Arimatéia - Analista de Sistemas Senior
http://felipearimateia.com/
(31) 92928793

--
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/d/optout.

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

0 comentários:

Postar um comentário