Below is a snippet of code in my service class.
If a user "joins a team" (operation = 0) then it create a notification with its designated specifications however if a user shares their location (operation = 1) then its supposed to create a separate foreground notification. Instead one just replaces the other.
I don't know why, they have different ID's just same channel. I've also tried separating their channel ID, still the same issue
int id = NOTIFICATION_LOCATION;
int icon = R.drawable.ic_gps_on;
String message = "Tap to disable location updates";
if (operation == 0) {
id = NOTIFICATION_RESPONDER;
icon = R.drawable.ic_responder_icon;
message = "Tap to leave the responding team";
}
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID_1)
.setSmallIcon(icon)
.setContentTitle("Location established")
.setContentText(message)
.setContentIntent(PendingIntent.getBroadcast(getApplicationContext(), 0, getBroadcastIntent(operation), PendingIntent.FLAG_UPDATE_CURRENT))
.setColor(ContextCompat.getColor(getApplicationContext(), R.color.primaryColor))
.setDefaults(Notification.DEFAULT_SOUND)
.setVisibility(VISIBILITY_PUBLIC)
.build();
startForeground(id, notification);