-
-
Save gabrielcbnetto/8f68cb754734e137df14 to your computer and use it in GitHub Desktop.
notification problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onNewIntent(Intent intent) { | |
Chamada chamada = (Chamada)intent.getSerializableExtra("chamada"); | |
if(chamada != null){ | |
abrirActivityConfirmaPassageiro(chamada.getId()); | |
} | |
super.onNewIntent(intent); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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