Skip to content

Commit eda5a58

Browse files
Add manual push completion handler support for iOS
Added Display.notifyPushCompletion() to allow applications to manually signal when they have finished handling a push notification on iOS. This is useful for apps that need to perform background tasks (like playing audio) before the app is suspended. This feature is enabled by setting the build hint `ios.delayPushCompletion` to `true`.
1 parent 6ff2213 commit eda5a58

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

CodenameOne/src/com/codename1/ui/Display.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5154,6 +5154,22 @@ public void screenshot(SuccessCallback<Image> callback) {
51545154
impl.screenshot(callback);
51555155
}
51565156

5157+
/**
5158+
* Notifies the platform that push notification processing is complete.
5159+
* This is useful on iOS where the app is woken up in the background to handle
5160+
* a push notification and needs to signal completion to avoid being suspended
5161+
* prematurely.
5162+
* <p>
5163+
* If the {@code ios.delayPushCompletion} build hint (or property) is set to "true",
5164+
* Codename One will NOT automatically signal completion after the {@link com.codename1.push.PushCallback#push(String)}
5165+
* method returns. Instead, the application MUST invoke this method manually
5166+
* when it has finished its background work (e.g. playing audio, downloading content).
5167+
* </p>
5168+
*/
5169+
public void notifyPushCompletion() {
5170+
impl.notifyPushCompletion();
5171+
}
5172+
51575173
/**
51585174
* Convenience method to schedule a task to run on the EDT after {@literal timeout}ms.
51595175
*

0 commit comments

Comments
 (0)