How to call a procedure when app is closed using Background Task extension?

Hi Everyone I have gone through the documentation of the Background task extension

and checked everywhere but didn’t get the solution

Now my problem is How can I call a procedure using task extension when the app is closed?

I haven’t tried anything because i wasn’t knowing how to properly use the extension this is the procedure I want to call when the app is closed

blocks (1)

Thanks in Advance

Solved by @ivan_fd

Thank you so much