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: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

what are ways of invoking the Application

Hi ,I am trying to invoke the app from BBM App,Apart from browser filtering ,What are ways to invoke the app.

 

thanks

Rakesh Shankar.P

BlackBerry Development Advisor
Posts: 15,752
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: what are ways of invoking the Application

Which app, a built in one or your own?  Are you trying to invoke one app from another?  Or do you mean how can the application itself be started?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: what are ways of invoking the Application

I am sending some sort of link from my app through BBM to other user,on linking the app,i should invoke the app.How can i do it,apart from browser filtering?

 

Thanks

Rakesh shankar.P

Highlighted
Developer
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: what are ways of invoking the Application

Hi Rakesh Shanker,

 

Before Invoke the Application you have to check the current state of the app.

 

Current state in the sense

 

1. The app is opened but it is in background.

 

2. The app is opened and it is foreground.

 

3. The app is not opened.

 

These are the three states. Now Checking the state of the app.

 

boolean isAppOpen = false;

int modHandle = CodeModuleManager.getModuleHandle(Your app .cod file name);

ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);

if(apDes != null)
 {

    ApplicationDescriptor[] foreground_apps = ApplicationManager.getApplicationManager().getVisibleApplications();

if(foreground_apps != null)
 {
  for(int i=0;i<foreground_apps.length;i++)
     {
       if(foreground_apps[i].equals(apDes[0]))
          {

           isAppOpen = true;

          process_id = ApplicationManager.getApplicationManager().getProcessId(apDes[0]);
          int fgprocess_id = ApplicationManager.getApplicationManager().getForegroundProcessId();
                                                            
             if(process_id == fgprocess_id)
                {
                     // This means that your app opened and it is foreground

                }
             else
             {
                //This means that your app is opened but it is background
                //Now request foreground
                ApplicationManager appManager = ApplicationManager.getApplicationManager();
                appManager.requestForeground(process_id);
              }

      }

    }

   }

if(!isAppOpen)
{

//This means that the app is not opened then you need to open the app.
ApplicationManager.getApplicationManager().runApplication(apDes[0]);
                                                    
}



Thanks.

 

Trusted Contributor
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900
My Carrier: Vodafone

Re: what are ways of invoking the Application

nice post.. its really Helpful...
Developer
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: what are ways of invoking the Application

Welcome