Run in the background. (IOS / Android)

Run in the background. (IOS / Android) 

I have an application and I need you to commence the background, from time to time perform a check on the DataSnap server and if needed, give a notification. 

Already read in some places something about it however nothing helped me. The application is in the background for a few seconds and the OS gets it on "pause" and not turning the code I need. 

How to solve this? Imagine a whatsapp chat or any program, it has to run in the background and give notifications for incoming messages. 

thank you

Comments