diff --git a/src/android/CustomFCMReceiverPlugin.java b/src/android/CustomFCMReceiverPlugin.java index 354d79cbc..b26343b78 100644 --- a/src/android/CustomFCMReceiverPlugin.java +++ b/src/android/CustomFCMReceiverPlugin.java @@ -78,6 +78,16 @@ public boolean onMessageReceived(RemoteMessage remoteMessage) { Log.d("CustomFCMReceiver", "onMessageReceived"); boolean isHandled = false; + int originalPriority = remoteMessage.getOriginalPriority(); + int currentPriority = remoteMessage.getPriority(); // PRIORITY_HIGH = 1, PRIORITY_NORMAL = 2, PRIORITY_UNKNOWN = 0 + + if (originalPriority != currentPriority) { + Log.e(TAG, "onMessageReceived: MESSAGE DEPRIORITIZED! originalPriority: " + originalPriority + " currentPriority: " + currentPriority); + // Note: apps running in the background have restrictions imposed on them: + // See doc: https://developer.android.com/develop/background-work/services/fgs/restrictions-bg-start + // When the message is deprioritized like this, this may result in issues later related to notifications, foreground services, etc. + } + try { Map data = remoteMessage.getData(); isHandled = inspectAndHandleMessageData(data);