I am developing an Android app, in which I have to call a particular web service, when user switches my app to background and vice versa.
When user moves my app to background, I have to call a particular method (web service) and when user switches my app to foreground, a method should be called.
How can I do this?
Read and understand about the Android Activity lifecycle and you will be rewarded with an answer.