sampath
sampath

Reputation: 51

How to identify whether application is running in background or not

I have an application that ask's password while clicking the application icon(ie. while entering the application). Then i have set UiApplication.getUiApplication().requestBackground(); where application is running in background.

Now if am again enter into the application means it have ask password.

Help me pl.

With regards, Sampath

Upvotes: 0

Views: 702

Answers (2)

Vit Khudenko
Vit Khudenko

Reputation: 28418

I think you may be interested in the Application.activate() method:

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.

The UiApplication extends Application so this method is also available in your UiApplication subclass.

Upvotes: 0

Martin
Martin

Reputation: 133

You can use UiApplication.getUiApplication().isForeground() method to determine if your application is in the foreground.

The isForeground method is inherited from net.rim.device.api.system Application class which also supports requestForeground and requestBackground methods.

http://www.blackberry.com/developers/docs/4.6.0api/net/rim/device/api/ui/UiApplication.html

Upvotes: 1

Related Questions