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

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

@simon , i hv tried too much to find on the forum btwen last two days... as u told " there was a post from a developer of such a software here in the forum where he explained how he did it...."

 

bt couldn't find til yet. do u remember any think related to that post, developer name of that post, any keyword related to title or the date or any other thing..???

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

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

sorry, no. maybe if you look up certain keywords like block etc you'll find it.
It's not my area of interest, so i did not bookmark it.
----------------------------------------------------------
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
rajani_dhawan
Posts: 55
Registered: ‎05-30-2011
My Device: BlackBerry torch 9800

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

hi...

as my basic requirement was how to close the native application(for ex calendar)-- through a backgrond process of third party app...

I call the following code within the cancel button's fieldChanged(Field field, int context) { } method......

try {
		
		EventInjector.KeyCodeEvent pressKey=new EventInjector.KeyCodeEvent(
				EventInjector.KeyCodeEvent.KEY_DOWN, ((char) Keypad.KEY_ESCAPE), 0);
		
		EventInjector.KeyCodeEvent releaseKey=new EventInjector.KeyCodeEvent(
				EventInjector.KeyCodeEvent.KEY_UP, ((char) Keypad.KEY_ESCAPE), 0);
		
		EventInjector.invokeEvent(pressKey);
		EventInjector.invokeEvent(releaseKey);
        
        
		} catch (Exception e) {
			System.out.println("\n\n >>>>>> Block App Excep Thread 6 : " + e.toString() + "\n");
		}		

 

But I am facing some problem with this code......

using this code Only those application are being closed, which can be closed using Escape key normally (like browser, memo, task, phone, sms, calculator, messenger etc.).

Native Applications or Any third party applications, which has override the functionality of escape key / close() ,  are not being closed by the above code...

Like :

1) Setup Wizard application in BlackBerry JRE 4.7 is not closed directly, when we pressed escape key.....on pressing escape key it will open a dialog box........and then user has to click on the ok/Exit button of dialog box to close it...

2) Options -> Device -> About Device Versions -> in BlackBerry JRE 6.0 is not closed directly, when pressed escape key.....

I have to use an approach from which can work globally and can close all the application (native / third-party), which has been saved in the Block-App list.

..

..

If we send the current foreground application(calender) into background (if it is a block app), then open Popup-screen (having Edit field, Unlock and Cancel Button - as I told earlier on this thread).........then

1) if user unlock the popup-screen by entering pin number, get that native app (calender) into foreground again.

2) if user cancel the popup-screen, then stop/close that native app (calender) through its process id.

So is there any method to do that...I have post this problem recently on the..

http://supportforums.blackberry.com/t5/Java-Development/how-can-stop-a-background-or-system-module-s...

thanks.



 


 

 

 

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

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

i hv found the solution....nothing new........  applications which were not closing through "Escape key " event , I pass the " End / Red " key event and send that applications to the backgorund.

 

kudos to @peter , @simon  for ur contribution.

 

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

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

wouldn't http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/ApplicationManager.html... be much easier for that?
----------------------------------------------------------
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