Skip to content

Instantly share code, notes, and snippets.

@gabrielcbnetto
Created May 23, 2013 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielcbnetto/8f68cb754734e137df14 to your computer and use it in GitHub Desktop.
Save gabrielcbnetto/8f68cb754734e137df14 to your computer and use it in GitHub Desktop.
notification problem
@Override
protected void onNewIntent(Intent intent) {
Chamada chamada = (Chamada)intent.getSerializableExtra("chamada");
if(chamada != null){
abrirActivityConfirmaPassageiro(chamada.getId());
}
super.onNewIntent(intent);
}
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Intent notificationIntent;
NotificationCompat.Builder builder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.icone_taxista)
.setContentTitle(Titulo)
.setContentText(mensagemBarraDeStatus).setAutoCancel(true).setDefaults(Notification.DEFAULT_SOUND).setVibrate(new long[] { 100, 250, 100, 500 });
if (Taxista.getInstance().isLogado())
notificationIntent = new Intent(context, MapaTaxista.class);
else
notificationIntent = new Intent(context, WaytaxiActivity.class);
if(chamada != null){
// Bundle b = new Bundle();
notificationIntent.putExtra("chamada", chamada);
}
notificationIntent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendintIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
builder.setContentIntent(pendintIntent);
Notification notification;
notification = builder.build();
notificationManager.notify(mensagemBarraDeStatus.hashCode(), notification);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment