SDK-324 - Updated way of handling notifications to not use AsyncTask #981
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔹 Jira Ticket(s) if any
✏️ Description
Migrates push notification handling from the deprecated
AsyncTaskto Android'sWorkManagerwith expedited work support.Why
AsyncTaskwas deprecated in API 30. Firebase and Android documentation explicitly recommendWorkManagerfor processing FCM messages:How
IterableFirebaseMessagingService- replacedAsyncTaskexecution withenqueueNotificationWork(), which schedules an expeditedOneTimeWorkRequestviaWorkManager. Includes a fallback that posts directly if scheduling fails.IterableNotificationWorkScheduler(new) - schedules expedited work withOutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST, ensuring notifications are always processed even when quota is exhausted.IterableNotificationWorker(new) -Workersubclass that deserializes notification data, builds the notification, and posts it. OverridesgetForegroundInfo()for pre-Android 12 compatibility.IterableNotificationHelper- added null-safety checks onextrasparameter.IterableNotificationManager- marked@Deprecated, kept for backward compatibility.Since
minSdkVersionis 21, devices running Android 5–11 requiregetForegroundInfo()to avoidIllegalStateExceptionwhen running expedited work:Dependencies
androidx.work:work-runtime:2.9.0androidx.work:work-testing:2.9.0(test only)