Skip to content

Commit

Permalink
[NO-TASK] Fix android SDK version for showing notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
memishood committed Feb 4, 2024
1 parent b1c25e7 commit 1a64682
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,13 @@ private void showNotification(final String msg, String tickerText, @NonNull Stri
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//The Error: it seems a bug in android greater than version 8, where it needs to Identify the channelId before a starting a foreground : https://stackoverflow.com/questions/47531742/startforeground-fail-after-upgrade-to-android-8-1/51281297#51281297
// It was Already Fixed in Android 12 :https://issuetracker.google.com/issues/192032398#comment6
Notification.Builder nBuilder = new Notification.Builder(this,channel);
Notification.Builder nBuilder;

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
nBuilder = new Notification.Builder(this,channel);
} else {
nBuilder = new Notification.Builder(this);
}

int priority;
if (channel.equals(NOTIFICATION_CHANNEL_BG_ID))
Expand Down

0 comments on commit 1a64682

Please sign in to comment.