You need to over ride the definition of activate on your class that extends UiApplication (or possibly Application):
Code:
public void activate()
Handles foregrounding event.
The system invokes this method when it brings this application to the foreground. By default, this method does nothing. Override this method to perform additional processing when being brought to the foreground.