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: 172
Registered: ‎01-02-2012
My Device: 8520 curve
Accepted Solution

pushing global push message on the screen

Hi 

 

   i am using push notification to display the push messages it is working fine,

 

   But my problem is that ,My message popup is comming while i am opening the app,But i want it to display over screen without opening the app,and after clicking ok it should open the app.

 

can any body help me.

 

thanks.

Developer
Posts: 16,517
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: pushing global push message on the screen

you can push a global screen from a non-ui application using

Ui.getUiEngine().pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
----------------------------------------------------------
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: 172
Registered: ‎01-02-2012
My Device: 8520 curve

Re: pushing global push message on the screen

[ Edited ]

Hi simon

  it's working fine,

          but i want to open my app after clicking ok on popup message,but i am not abel to do that can you help me for that

 

here is my code

 

 Application.getApplication().invokeLater(new Runnable()
            {
                public void run()
                {

UiEngine ui = Ui.getUiEngine();
                 Screen screen = new Dialog(Dialog.D_OK, " New apdates" ,
                 Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),Manager.VERTICAL_SCROLL);
                                      
                 
                      ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
                      PersistentStorage_Sasta_High.setTotalMsgCountDec();
                      PushController_Sasta_High.updateIndicator(PersistentStorage_Sasta_High.getTotalMsgCount());
                  

                    UiApplication.getUiApplication().pushScreen(new SplashScreen_Land());

}
            });

 

this code is redirecting on splash screen if i allready opend the app,but it is not opening my app if it is closed.

 

 

can you help me .

 

thanks.

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

Re: pushing global push message on the screen

Hi Avinash,

 

Is your push application extends Application or UiApplication?

Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve

Re: pushing global push message on the screen

hi i am not extending any thing just i am using application thread which i mension in above code and my that all code has written in side process() method.

 

thanks.

Developer
Posts: 16,517
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: pushing global push message on the screen

i would suggest that you take a look at http://supportforums.blackberry.com/t5/Java-Development/Set-up-an-alternate-entry-point-for-an-appli...

you can run the push listener in the context of an autostart application, from the global dialog you can use applicationmanager to launch your ui application.
----------------------------------------------------------
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: 543
Registered: ‎12-23-2010
My Device: Z10

Re: pushing global push message on the screen

Hi Avinash,

 

if you are trying to open the application from the background application then
push the dialog screen from background thread and in that dialog closed listener you have to open your main application like this.   

 

See this link:

http://supportforums.blackberry.com/t5/Java-Development/what-are-ways-of-invoking-the-Application/m-...

 

Note :If you want to communication between two applications then you can use Runtime store when the main application not opened, and GlobalEventListener when the Main app is is opened or in Background.

 

Thanks. 

Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve

Re: pushing global push message on the screen

Hi

    still I am not able to open the app by clicking on push message popup,I tried to check foreground and background process also and after that I am calling the screen of my app.

 

 actually I wanted to open the screen of my app for which the information given by push messages,Means push popup can be more and it should be open the page separately by each popup.

 

Thanks.

Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve

Re: pushing global push message on the screen

Hi

 

 i am using below code to run the ap on globle push message popup click event. but i am not able to run it can any budy find it what the wrong with this code.

 

 

UiEngine ui = Ui.getUiEngine();
//                 Screen screen = new Dialog(Dialog.D_OK, SplashScreen_Land.dealTitle1 ,
//                 Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),Manager.VERTICAL_SCROLL);
                final Dialog screen = new Dialog(Dialog.D_YES_NO, SplashScreen_Land.dealTitle1 ,
                         Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),Manager.VERTICAL_SCROLL);
                 screen.setDialogClosedListener(new DialogClosedListener()
                 {

                     public void dialogClosed(final Dialog dialog, final int choice)
                     {
                         if (screen.getSelectedValue() == Dialog.YES)
                         {
                                                 boolean isAppOpen = false;
                            
                                                  int modHandle = CodeModuleManager.getModuleHandle("Sasta");

                                                   ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
                            
                                                   if(apDes != null)
                                                    {
                                                      // Dialog.alert("hi not 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;
                            
                                                            int process_id = ApplicationManager.getApplicationManager().getProcessId(apDes[0]);
                                                             int fgprocess_id = ApplicationManager.getApplicationManager().getForegroundProcessId();
                                                                                                               
                                                                if(process_id == fgprocess_id)
                                                                   {//Dialog.alert("hiforground");
                                                                        // This means that your app opened and it is foreground
                                                                    UiApplication.getUiApplication().pushScreen(new SplashScreen_Land());
                            
                                                                   }
                                                                else
                                                                {//Dialog.alert("hi background");
                                                                   //This means that your app is opened but it is background
                                                                   //Now request foreground
                                                                   ApplicationManager appManager = ApplicationManager.getApplicationManager();
                                                                   appManager.requestForeground(process_id);
                                                                  
                                                                   //UiApplication.getUiApplication().pushScreen(new SplashScreen_Land());
                                                                 }
                            
                                                         }
                            
                                                       }
                            
                                                      }
                            
                                                   if(!isAppOpen)
                                                   {
                            
                                                   //This means that the app is not opened then you need to open the app.
                                                   try {//Dialog.alert("hi new open");
                                                     ApplicationManager.getApplicationManager().runApplication(apDes[0],true);
                                                 //    UiApplication.getUiApplication().pushScreen(new SplashScreen_Land());
                                                 } catch (ApplicationManagerException e) {
                                                     // TODO Auto-generated catch block
                                                     e.printStackTrace();
                                                 }
                                                                                                       
                                                   }
                            
                            
                            
                                                    }
                             //UiApplication.getUiApplication().pushScreen(new SplashScreen_Land());
                             //Alert.startVibrate(2000);
                             //do something which takes some time
                         }
                         else
                         {
                             screen.close();
                         }

                     }
                 });
            
            
          
                      ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_MODAL);
                      PersistentStorage_Sasta_High.setTotalMsgCountDec();
                      PushController_Sasta_High.updateIndicator(PersistentStorage_Sasta_High.getTotalMsgCount());

Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve

Re: pushing global push message on the screen

Hi

  I got the solution I can open my app

 

 

but one more problem is that if push messages is more than one it is opening my app one by one this I don't want ,

 

i want to cancel the messages which I don't want to see.

 can any body help.

 

Thanks.