I have the following code:
public void sendNewNotification (Booking updateBooking) {
String msg;
if (updateBooking.getJobStatus () == Booking.eeJob_OnRoute) {
msg = "Your driver has been dispatched.";
} else if (updateBooking.getJobStatus () == Booking.eeJob_POB) {
msg = "Your driver has arrived.";
} else if (updateBooking.getJobStatus () == Booking.eeJob_Complete) {
Variables.driverrated = false;
msg = "Your booking has been completed. Thank you for using " + Variables.setting.getCompanysName () + ".";
} else if (updateBooking.getJobStatus () == Booking.eeJob_NoShow) {
msg = "Unfortunately your driver was unable locate you. Please call the office on " + Variables.setting.getCompanytelephone () + ".";
} else if (updateBooking.getJobStatus () == Booking.eeJob_Cancelled) {
msg = "Your booking has been cancelled. Please call the office on " + Variables.setting.getCompanytelephone () + " if this is incorrect.";
} else {
return;
}
PendingIntent detailsIntent = PendingIntent.getActivity (this, 0, new Intent (this, HomeActivity.class)
.putExtra ("booking", updateBooking)
.putExtra ("track", false),
PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent trackingIntent = PendingIntent.getActivity (this, 0, new Intent (this, HomeActivity.class)
.putExtra ("booking", updateBooking)
.putExtra ("track", true),
PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder (this);
builder.setAutoCancel (true);
builder.setDefaults (Notification.DEFAULT_ALL);
builder.setWhen (System.currentTimeMillis ());
builder.setContentTitle (Variables.setting.getCompanysName () + " - booking update");
builder.setSmallIcon (R.drawable.notification);
builder.setTicker (Variables.setting.getCompanysName () + " - booking update");
builder.setPriority (NotificationCompat.PRIORITY_HIGH);
builder.setContentText (msg);
builder.setContentIntent (trackingIntent);
builder.addAction (R.drawable.documents_32px, "DETAILS", detailsIntent);
if (updateBooking.getJobStatus () != Booking.eeJob_Complete) {
builder.addAction (R.drawable.notification, "TRACK", trackingIntent);
} else {
builder.addAction (R.drawable.profile_32px, "RATE", detailsIntent);
}
NotificationManager manager = (NotificationManager) getSystemService (NOTIFICATION_SERVICE);
manager.notify (getTaskId (), builder.build ());
}
My issue is in my onCreate function I have these two lines:
m_updateBooking = (Booking) getIntent ().getSerializableExtra ("booking");
m_TrackDriver = (Boolean) getIntent ().getSerializableExtra ("track");
m_updateBooking
works flawlessly. But m_TrackDriver
is ALWAYS true. No matter what button I press. Can anyone explain why this is?
Thanks in advance for all your help.