Skip to content

Commit 1b58c74

Browse files
LucasNovaestyllark
authored andcommitted
fix(amplify_push_notifications): replace removeFirst() with removeAt(0) for Android < 11 compatibility
The removeFirst() method from the Kotlin standard library is only available on Android 11 (API 30) and above, or when running on a full Java 11+ runtime. On older Android versions, this causes a NoSuchMethodError at runtime. This commit replaces removeFirst() with removeAt(0), which provides the same behavior and works correctly on all supported Android API levels (minSdk 21+). No functional behavior changes have been made — only improved runtime compatibility.
1 parent 520d2ad commit 1b58c74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/notifications/push/amplify_push_notifications/android/src/main/kotlin/com/amazonaws/amplify/amplify_push_notifications/PushNotificationEventsStreamHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class PushNotificationEventsStreamHandler constructor(
102102
try {
103103
eventSink?.let {
104104
while (eventQueue.isNotEmpty()) {
105-
val eventFromQueue = eventQueue.removeFirst()
105+
val eventFromQueue = eventQueue.removeAt(0)
106106
// Check if it is an Error event and handle accordingly by using .error method
107107
if (eventFromQueue.event.eventName == NativeEvent.ERROR.eventName) {
108108
val exception = eventFromQueue.error

0 commit comments

Comments
 (0)