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: 55
Registered: ‎05-30-2011
My Device: BlackBerry torch 9800
My Carrier: Airtel

Re: global event listener is not called instantly and properly on device.

[ Edited ]

@ Peter - Still I can’t solve the problem regarding how to close the native applications.

 

Please help, it’s a very important task of my project.

 

I have tried to get the “menu” instance under the “invoke later” –

Screen screen = Ui.getUiEngine().getActiveScreen();

Menu menu = screen.getMenu(0);

But it is always return the screen instance (BlockAppScreen) of the my background third party block-app.

 

here is the code... as i told u in the thread -

http://http://supportforums.blackberry.com/t5/Java-Development/how-to-pause-the-timer-thread/m-p/174...

 

 

public void run() {
		
		for (;flag;) {
			try {
				
				UiApplication.getUiApplication().invokeLater(new Runnable() {
					public void run() {						
                                                ///////////  ?????? //
                                                ///////////  ?????????//
						Screen screen = Ui.getUiEngine().getActiveScreen();
						System.out.println("\n\n**** " + screen.getClass().getName());
						
						Menu menu = screen.getMenu(1);
						for (int i = 0, cnt = menu.getSize(); i < cnt; i++)
							System.out.println(" menu item : " + menu.getItem(i).toString());
						
						System.out.println("\n\n");
						
						-    Run the code to check whether current foreground app’s name is present into
                                                  block-apps-list or not.

                                            -    If present then under

                                                     synchronized(Application.getEventLock()) {

                                           -    open popup-screen and “enterBlock = true”

                                                   }

 

                                                  -    Control return here when user clicks on one of the Unlock / Cancel button of popup

                                                        screen and put enterBlock = false into filedChanged method of Unlock / Cancel

                                                         button.

                                      } //close run method

                                   }); // close invoke later.

            

                        while(enterBlock) {

                              try {

                                    Thread.sleep(2000);

                              } catch (Exception e) {   }

                        }

                        enterBlock = false;

                       

                  } catch (Exception e) { }

                   finally {

                        try {

                              Thread.sleep(2000);

                        } catch (InterruptedException e) {}

                  }                      

            } // close for loop                            

      } // end of thread’s run

 

 

Is there any method to get the instance of current focused foreground screen class, so that we can get the menu instance of that screen class and run the close menu item…..from any third party application.

 

I also want to discuss the other approach you have told……. “Even with a modal display, the user can use the task switcher to switch to the native app……”.

Would u please elobarate that.

Or give me any links regarding "Application Switcher".  How can we get the instance of background applications from application switcher...???

 

thnks.

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

Re: global event listener is not called instantly and properly on device.

no, you cannot get a reference to another application.

i think the applications on the switcher are listed as visible applications in application manager.
----------------------------------------------------------
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: 55
Registered: ‎05-30-2011
My Device: BlackBerry torch 9800
My Carrier: Airtel

Re: global event listener is not called instantly and properly on device.

ya @simon, i get the app's name from visible applications in Application Manager.

 

as follows :

 

private int getForegroungProcessID() {
        return ApplicationManager.getApplicationManager().getForegroundProcessId();
    }
    
    private String getAppNameByProcessId(int id) {
        String result = null;
        
        ApplicationManager appManager = ApplicationManager.getApplicationManager();
        ApplicationDescriptor appDes[] = appManager.getVisibleApplications();
        
        for (int i = 0; i < appDes.length; i++) {
            if (appManager.getProcessId(appDes[i]) == id) {
                result = appDes[i].getName();
                break;
            }
        }
        return result;
    }

 

But I didn't get any idea how can we close the native app... from our third party's thread.

This is the last taks, which is now become very difficult for me...... and i become stuck on this...

 

Smiley Sad   Smiley Sad

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

Re: global event listener is not called instantly and properly on device.

well, i already told you that you cannot exit another app, if you decided not to believe me, totally up to you...
----------------------------------------------------------
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: 55
Registered: ‎05-30-2011
My Device: BlackBerry torch 9800
My Carrier: Airtel

Re: global event listener is not called instantly and properly on device.

Hey @simon. I have believe on you guys....thts why I am here on BB forum...

 

But as I already told on this thread about Mr. Safe Application,

 how can i believe on this statement that "Closing any Native applications in BB platform from a third party app is not possible" untill I know that Mr. Safe does this task perfectly.

 

I think you should try the trail version of Mr. Safe at least once and test its functionality in stead of thinking that I dont hv believe on you...

 

hope u undrstnd the actual fact and try to  

 

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

Re: global event listener is not called instantly and properly on device.

Contact the develoeprs and ask how they did it?

Developer
Posts: 55
Registered: ‎05-30-2011
My Device: BlackBerry torch 9800
My Carrier: Airtel

Re: global event listener is not called instantly and properly on device.

Hey Peter...do u really think tha "Spice" or any other company will provide the funtioing of their copyright project... sorry bt i dont think so... hv u ever contact to any vendor for asking the technique about their any software..... hv u ever get solution like this???

Reading this unexpected suggestion of yours I became speechless... Smiley Surprised

 

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

Re: global event listener is not called instantly and properly on device.

there was a post from a developer of such a software here in the forum where he explained how he did it, but i don't have it bookmarked (not my field of interest) - some of our insights just repeat his findings.

If you don't ask for much and be polite you can give it a try, don't mail the sales office but the developer himself though Smiley Happy
----------------------------------------------------------
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: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: global event listener is not called instantly and properly on device.

I agree with Simon.  If someone asks nicely then I think most developers will respond as best they can given commercial interests.  Effectively that is true for responders on this forum in general - I think you will find we don't give out code where this is commercial, but are not so shy about giving out ideas. 

 

Developer
Posts: 55
Registered: ‎05-30-2011
My Device: BlackBerry torch 9800
My Carrier: Airtel

Re: global event listener is not called instantly and properly on device.

ya @simon, @peter, i am also agree with both of you..

 

it is always appreciable to give out ideas atleast if someone dont want to give the code... i hv gone through the Spice website http://www.spicelabs.in/

bt cant see any contact-emails of developers  and as simon suggest, i dont think its good to send mail to customer-support service..

 

i'll try to find here in the forum realted to this problem...bt i think it will take too much time. @simon, do u remember a little info related to that post, like developer name - who had explained this task,  title / related tags???