Fix incoming call notifications not being removed on some devices

This commit is contained in:
xynngh 2020-05-16 17:26:48 +04:00
parent 930372f488
commit 29e43fec3c
2 changed files with 5 additions and 6 deletions

View File

@ -73,7 +73,7 @@ public class CallReceiver extends BroadcastReceiver {
}
} else if(TelephonyManager.EXTRA_STATE_IDLE.equals(telephonyExtraState)) {
isOnCall = false;
NotificationHelper.hideIncomingCallNotification(context, incomingNumber);
NotificationHelper.hideIncomingCallNotification(context);
postEvent(new CallEndedEvent());
}
}

View File

@ -54,13 +54,12 @@ public class NotificationHelper {
public static void showIncomingCallNotification(Context context, NumberInfo numberInfo) {
Notification notification = createIncomingCallNotification(context, numberInfo);
String tag = numberInfo.number != null ? NOTIFICATION_TAG_INCOMING_CALL + numberInfo.number : null;
notify(context, tag, NOTIFICATION_ID_INCOMING_CALL, notification);
notify(context, NOTIFICATION_TAG_INCOMING_CALL, NOTIFICATION_ID_INCOMING_CALL, notification);
}
public static void hideIncomingCallNotification(Context context, String number) {
String tag = number != null ? NOTIFICATION_TAG_INCOMING_CALL + number : null;
NotificationManagerCompat.from(context).cancel(tag, NOTIFICATION_ID_INCOMING_CALL);
public static void hideIncomingCallNotification(Context context) {
NotificationManagerCompat.from(context)
.cancel(NOTIFICATION_TAG_INCOMING_CALL, NOTIFICATION_ID_INCOMING_CALL);
}
public static void showBlockedCallNotification(Context context, NumberInfo numberInfo) {