How to detect if app is in foreground or background and run the appropriate blocks. I have itoo added.
I know in background for instance I cannot write to textbox's.
There must be some option to say if foreground do X if background do Y
I am assuming
Foreground - App is the current one displaced on the screen (has focus)
Background app is not on screen (lost focus). possibly some other app is displayed or the phone is not being used , idle.