Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 204
Registered: ‎07-09-2009
My Device: Not Specified

Tell when an app has been launched?

[ Edited ]

Is there a way to tell when an app has been launched without polling, like a global event that notifies of an app launch, or would I have to poll continuously for which app is in the foreground?

 

Does anyone know how much effect that would have on battery life and performance-- if there were a timer triggering every half second constantly and it just checks if a certain app is in the foreground?

 

Thank you

Developer
Posts: 141
Registered: ‎02-10-2010
My Device: 9500
My Carrier: Airtel

Re: Tell when an app has been launched?

You may check for application presence using ApplicationManager.getVisibleApplications. If you find the desired app in the list, then you may check whether its in foreground or not.

 

For 15 seconds poll frequency with some amount of data crunching after every poll impacted battery to a negligible extent(8% for 12 hours). You may want to evaluate for lower values still.

 

 

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Tell when an app has been launched?

"Is there a way to tell when an app has been launched without polling"

Not that I am aware of.

 

"Does anyone know how much effect that would have on battery life and performance"

Try it and see.