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

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


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?

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