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: 139
Registered: ‎05-25-2009
My Device: Not Specified
Accepted Solution

How to find the list ot background application

Dear Friends,

 

             Can anyone tell me how to find the applications which are running in the background and how move the application to background.

if u can pls bring me some sample codes too.

 

regards,

s.kumaran.

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to find the list ot background application

ApplicationManager getVisibleApplications()
Retrieves descriptors for the visible, running applications.

getForegroundProcessId()
all others are in the background

requestForeground(int processId)
request an app to come to the foreground

requestForegroundForConsole()
shows the homescreen
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 139
Registered: ‎05-25-2009
My Device: Not Specified

Re: How to find the list ot background application

thanks for immediate response.Could u pls sent me some sample code,i m new this blackberry developement so,i don't to how to start and how to proceed. pls help me ..

 

 

regards,

s.kumaran.

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to find the list ot background application

check the ApplicationManager API. you get the instance and call the methods.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 173
Registered: ‎06-11-2009
My Device: Not Specified

Re: How to find the list ot background application

OK, here is kinda related Q: Why I do not see myself?
I mean, here is code:

class RunB extends Application {
public static void main(String[] args) {
ApplicationManager manager = ApplicationManager.getApplicationManager();
ApplicationDescriptor [] descriptorsV = manager.getVisibleApplications();
int lenV = descriptorsV.length;
for (int i=0;i<lenV;i++)
System.out.println("Vp: "+descriptorsV[i].getName()+" mn: "+descriptorsV[i].getModuleName()+" ID: "+manager.getProcessId(descriptorsV[i]));

System.exit(0);
}
}

 Return printout from simulator is following:

Starting RunB
Started RunB(181)
Vp: Home Screen mn: net_rim_bb_ribbon_app ID: 109
Vp: Messages mn: net_rim_bb_messaging_app ID: 87
Vp: Phone mn: net_rim_bb_phone_app ID: 90
Vp: Browser mn: net_rim_bb_browser_daemon ID: 101
Vp: BlackBerryMessenger mn: net_rim_bb_qm_peer ID: 126
Exit RunB(181)

 So, why I do not see my process (RunB) in this list of visible processes?

 

Highlighted
Developer
Posts: 58
Registered: ‎09-23-2009
My Device: Not Specified

Re: How to find the list ot background application

[ Edited ]

Seems like there is no modules in your application so 

descriptorsV[i].getModuleName()

return null and whole pintln goes null.

Try this:

class RunB extends Application {
public static void main(String[] args) {
ApplicationManager manager = ApplicationManager.getApplicationManager();
ApplicationDescriptor[] descriptorsV = manager.getVisibleApplications();
int lenV = descriptorsV.length;
for (int i = 0; i < lenV; i++)
System.out.println("Vp:" + descriptorsV[i].getName() + "ID:"
+ manager.getProcessId(descriptorsV[i]));
System.exit(0);
}
}

Check out SO - How to get the background application process id

Message Edited by mgontar on 09-23-2009 04:38 AM