Skip to content

Commit

Permalink
Resolving Telephony Notifications Overlapping Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
choiman1559 committed Jul 20, 2023
1 parent 8e37f72 commit 328118a
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,14 @@ protected void sendTelecomNotification(Map<String, String> map) {
.setContentText("click here to reply or open dialer")
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(pendingIntent)
.setGroup(getPackageName() + ".NOTIFICATION")
.setGroupSummary(true)
.setAutoCancel(true);

if(Build.VERSION.SDK_INT < 33) {
builder
.setGroup(getPackageName() + ".NOTIFICATION")
.setGroupSummary(true);
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setSmallIcon(R.drawable.ic_notification);
CharSequence channelName = getString(R.string.notify_channel_name);
Expand All @@ -547,7 +551,7 @@ protected void sendTelecomNotification(Map<String, String> map) {
} else builder.setSmallIcon(R.mipmap.ic_notification);

assert notificationManager != null;
notificationManager.notify((int) ((new Date().getTime() / 1000L) % Integer.MAX_VALUE), builder.build());
notificationManager.notify(uniqueCode, builder.build());
playRingtoneAndVibrate();
}

Expand Down Expand Up @@ -588,10 +592,14 @@ protected void sendSmsNotification(Map<String, String> map) {
.setContentText(message)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(pendingIntent)
.setGroup(getPackageName() + ".NOTIFICATION")
.setGroupSummary(true)
.setAutoCancel(true);

if(Build.VERSION.SDK_INT < 33) {
builder
.setGroup(getPackageName() + ".NOTIFICATION")
.setGroupSummary(true);
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setSmallIcon(R.drawable.ic_notification);
CharSequence channelName = getString(R.string.notify_channel_name);
Expand All @@ -604,7 +612,7 @@ protected void sendSmsNotification(Map<String, String> map) {
} else builder.setSmallIcon(R.mipmap.ic_notification);

assert notificationManager != null;
notificationManager.notify((int) ((new Date().getTime() / 1000L) % Integer.MAX_VALUE), builder.build());
notificationManager.notify(uniqueCode, builder.build());
playRingtoneAndVibrate();
}

Expand Down

0 comments on commit 328118a

Please sign in to comment.