Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] App fixada no StatusBar (Em andamento)

eu estou usando como no codigo abaixo (resolveu em partes o meu problema tb), estou usando o modo de compatibilidade e tive que "setar" mBuilder.setOngoing(true). Resolvi em partes pq sempre abre uma nova activity, quero q isso fiuncione como vc disse,  O cliente precisa ver que a app está em execução (mesmo que em pausa). Daí a solução que achei interessante é fixar o app na StatusBar. Assim, ao abrir a StatusBar e clicar o app abre sua tela principal.


public void setupNotification(){
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Title")
.setContentText("TEXT");
mBuilder.setOngoing(true);
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, MainActivity_v11.class);

// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(MainActivity_v11.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);

mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(222, mBuilder.build());
}

Em 5 de março de 2013 14:41, Geronildo Jr. <geronildojr@gmail.com> escreveu:
Prezados, bom dia!

Peço ajuda da comunidade para me dar uma luz acerta de como implementar minha app de modo que a mesma fique fixa no StatusBar (como o app do Avast, por exemplo, que fica na parte "Em andamento"). O cliente precisa ver que a app está em execução (mesmo que em pausa). Daí a solução que achei interessante é fixar o app na StatusBar. Assim, ao abrir a StatusBar e clicar o app abre sua tela principal. Tentei achar algum exemplo no google, mas só me aparece exemplos e Notificação (que minha app já tem). :)



Atenciosamente,


Geronildo Jr.
Twitters: @GeronildoJr || @GeronDesign
 

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