Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Chamar método em uma Notificação

Você pode passar alguns extras no intent, não?

Aí lá na usa Activity fosse verificaria os extras e chamaria o método desejado.


Em qua, 23 de set de 2015 às 10:59, Márcio Fornari <marciofornari@gmail.com> escreveu:
Bom dia Pessoal, Tenho uma notificação que ao clicar nela abre a MainActivity, porém gostaria de chamar um Método que está dentro de um Fragment, é possível isso?

Segue o código da notificação

  1. Notification notification = new Notification(R.mipmap.ic_servico_ativo,
  2.                 getText(R.string.servico),System.currentTimeMillis());
  3.         //Chamo a MainActivity ao clicar na notificação
  4.         Intent notificationIntent = new Intent(this, MainActivity.class);
  5.  
  6.         PendingIntent pendingIntent = PendingIntent.getActivity(this0, notificationIntent, 0);
  7.         notification.setLatestEventInfo(this, getText(R.string.notificacao_titulo),
  8.                 getText(R.string.notificacao_msg),
  9.                 pendingIntent);
  10.         startForeground(10000, notification);

--
............
Márcio Fornari 

..........................................................................

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

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

0 comentários:

Postar um comentário