Background App Refresh implementation samples

Has anyone tried to implement background fetch which can be used to regularly poll server for changes or updates.

Here is the apple official document
https://developer.apple.com/documentation/uikit/core_app/managing_your_app_s_life_cycle/preparing_your_app_to_run_in_the_background/updating_your_app_with_background_app_refresh

Any java method implementation of the above mentioned code performFetchWithCompletionHandler would help.

Regards,
Sachin

It is a applicationPerformFetchWithCompletionHandler method in UIApplicationDelegate, which is implemented by your main application class.

Update 1: I’m stopping the background task once im done with my work

I was able to implement the method in UIApplicationDelegate however im not able to achieve consistent polling time. Do i need to stop the background service upon completion?

@Override
@Selector("application:performFetchWithCompletionHandler:")
public void applicationPerformFetchWithCompletionHandler(
        UIApplication application,
        @ObjCBlock(name = "call_applicationPerformFetchWithCompletionHandler") UIApplicationDelegate.Block_applicationPerformFetchWithCompletionHandler completionHandler){
//Do the work, not ending background task
}