Skip to content

Commit

Permalink
increase Android notification priority, show above other apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Julesssss committed Dec 16, 2022
1 parent 550756f commit 58932f6
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.expensify.chat.customairshipextender;

import static androidx.core.app.NotificationCompat.PRIORITY_MAX;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
Expand Down Expand Up @@ -76,6 +78,13 @@ protected NotificationCompat.Builder onExtendBuilder(@NonNull Context context, @
super.onExtendBuilder(context, builder, arguments);
PushMessage message = arguments.getMessage();

// Configure the notification channel or priority to ensure it shows in foreground
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setChannelId(CHANNEL_MESSAGES_ID);
} else {
builder.setPriority(PRIORITY_MAX);
}

if (message.containsKey(PAYLOAD_KEY)) {
try {
JsonMap payload = JsonValue.parseString(message.getExtra(PAYLOAD_KEY)).optMap();
Expand Down

0 comments on commit 58932f6

Please sign in to comment.