Added support for backgrounding the IOS application for a number of seconds.

Removed duplicate code

Added test case