BlackBerry Forums Support Community

BlackBerry Forums Support Community (
-   Developer Forum (
-   -   END Call button event issue. (

smokingfly 08-02-2010 07:46 AM

END Call button event issue.
Hi All,

I am writting an application for Strom 2 9520. My application is a background application & it uses the PhoneListener events. When user dials a number, my application captures "CallInitiated" event. Then, in my code, I disconnect the call & in "callDisconnected" event, I displayed a message "Call Disconnected".
On simulator it works fine. But , whne I load the application on device, it doesn't work properly.
When I run on device, & make a call, "Callinitiated" event occurs, but call doesn't disconnected.

Following is the code I wriiten to disconnect the call:
EventInjector.KeyCodeEvent ev = new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEv ent.KEY_DOWN, ((char)Keypad.KEY_END), KeypadListener.STATUS_NOT_FROM_KEYPAD);


I think, my code doesn't trigger the END key. But it works fine on simulator.

Please help me. Thanks in advance.

Dougsg38p 08-02-2010 09:19 AM

Most likely, event injection is disabled in the application permissions.

vivartpandey 08-03-2010 12:16 AM

yeah in real device you have to enable key event injection.
Options => Advanced Options => Applications => [Your Application] =>Edit Default permissions =>Interactions =>key stroke Injection

read this article.
How to disconnect a call in blackberry

smokingfly 08-03-2010 04:25 AM

Thanks for the quick reply. I have set permissions on my device as per your suggestions. But, is there some way such that user don't need to change the permission, i.e. ,is there some way to set this permission programatically or while loading the application onto the device.

Secondly, after setting the permission, when my application presses END key, device shows some "Security" message everytime. Is there some way to get rid of this message?

Thanks again for your replies.

vivartpandey 08-03-2010 04:26 AM

In that article itself given a second way.
by pressing end menu option for that you no need set any permission.

smokingfly 08-03-2010 05:11 AM

Thanks for reply.

I tried the second option. But it didn't work properly. I tried on simulator & simulator hangs. I tried to debug it, but didn't find properly reason.
menu.getSize() return 12. So the loop runs 12 times. In the loop, there is print statement. All the 12 prints get printed, but no item has value 69632.
menu 0 :4096 - Help
menu 1 :70224 - Flash
menu 2 :71760 - Enhance Call Audio
menu 3 :71936 - Mute
menu 4 :77824 - Notes
menu 5 :1441792 - Activate Speakerphone
menu 6 :16777280 - View Contacts
menu 7 :16777280 - View Calendar
menu 8 :16777280 - View Messages
menu 9 :268500997 - Show Dialpad
menu 10 :268501000 - Switch Application
menu 11 :268501008 - Home Screen
Can you please elaborate further, where I am wrong.


smokingfly 08-04-2010 01:41 AM


Please help me. I am still finding the solution.

Thanks & Regards

vivartpandey 08-04-2010 01:57 AM

yeah i have tested on storm its not working for storm.

smokingfly 08-04-2010 02:19 AM

Thanks for reply.

Is there any other way to do this?

smokingfly 08-04-2010 03:53 AM


In real device I have to enable key event injection as per the steps told above.
Options => Advanced Options => Applications
=> [Your Application] =>Edit Default permissions =>Interactions =>key stroke Injection

Is it possible to enable it through application?


Dougsg38p 08-04-2010 08:25 AM

See the class ApplicationPermissions and ApplicationPermissionsManager

You cannot set these without user intervention, but these classes allow you to set up the permissions, then prompt the user to "accept" them (rather than making the user go set them manually).

smokingfly 08-05-2010 12:02 AM


Thanks to you all. I have done that using ApplicationPermissions and ApplicationPermissionsManager.

Thanks once again.

All times are GMT -5. The time now is 07:59 PM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.