diff --git a/src/apis/registerHeadlessTask.ts b/src/apis/registerHeadlessTask.ts index f382930..4572ea5 100644 --- a/src/apis/registerHeadlessTask.ts +++ b/src/apis/registerHeadlessTask.ts @@ -4,6 +4,7 @@ import type { NativeMessage, PushNotificationMessage } from '../types'; import { normalizeNativeMessage } from '../utils'; import { getConstants } from './getConstants'; +import { completeNotification } from './completeNotification'; export const registerHeadlessTask = ( task: (message: PushNotificationMessage | null) => Promise @@ -14,6 +15,9 @@ export const registerHeadlessTask = ( NativeHeadlessTaskKey, () => async (nativeMessage: NativeMessage) => { await task(normalizeNativeMessage(nativeMessage)); + if (nativeMessage.completionHandlerId) { + completeNotification(nativeMessage.completionHandlerId); + } } ); }