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
New Developer
Posts: 86
Registered: ‎11-19-2008
My Device: Not Specified
Accepted Solution

Programmatically reject a call

Hi guys,

I'm currently writing an app that needs to reject a call (because the call from a special number is just a "notification" to do something else). I'm using the callIncoming method for this, and simulating the click on the "End call" meu item, like this:

 

 

public void callIncoming(int callId) { UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { try { Menu menu = UiApplication.getUiApplication().getActiveScreen().getMenu(0); for (int i = 0; i <= menu.getSize() - 1; i++) { System.out.println("menu " + i + " :" + menu.getItem(i).getOrdinal() + " - " + menu.getItem(i).toString()); if (menu.getItem(i).getOrdinal() == 69632) { menu.getItem(i).run(); System.out.println("blocked call"); } } } catch (Exception ex) { System.out.println(ex.getMessage()); } } }); }

 

 this works almost fine with the Curve 8300 (except for the fact that I still need to close the "Missed call" dialog that pops up when I interrupt the call). However it does not work with the Bold simulator.

 

The debug information shows that it finds the following menu items:

 

menu 0 :4096 - Help
menu 1 :70912 - Join Conference
menu 2 :71936 - Mute
menu 3 :77824 - Notes
menu 4 :77840 - Return to Phone
menu 5 :1266752 - Activate Speakerphone
menu 6 :16982272 - Options
menu 7 :16982273 - Status
menu 8 :268501000 - Switch Application
menu 9 :268501008 - Close

 

I tried to use the invokeLater overloads that takes a delay, and specified 500 or 1000 as a delay, but nothing changes. Even in that case, the Runnable is executed immediately, and I get those menu items - there is no "End call" item!

 

Can you explain why is that, and a workaround?

Thanks a lot in advance for the help.

 

New Developer
Posts: 86
Registered: ‎11-19-2008
My Device: Not Specified

Re: Programmatically reject a call

up
New Developer
Posts: 86
Registered: ‎11-19-2008
My Device: Not Specified

Re: Programmatically reject a call

up
New Developer
Posts: 27
Registered: ‎04-09-2009
My Device: Not Specified

Re: Programmatically reject a call

hi devguy,

 

I am presently stuck at the point where you were a few months back. Was wondering if you could work around this problem. If you have then will you pass me some clue. Will help readers in future as well.

 

-/FG

Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Programmatically reject a call

I think you can go for EventInjector strategies..

 

Thanks! 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Highlighted
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: Programmatically reject a call

The Bold does not have the 'End call' option in the menu.

 I don't know if that's true for all versions >= 4.6.x but it's true for Bold with 4.6.x. (can anyone confirm for other devices on the >=4.6.x?)

 

So you cannot use this trick anymore. 

It seems that either:

a) RIM didn't like giving this option to the developers (their people maybe saw this forum's threads explaining the trick)  or

b) RIM's policy changed for some other reason.

 

personally, I like having this option on the full menu, but have rarely used it.



"Listen carefully, I shall say this only once"
Developer
Posts: 16,838
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Programmatically reject a call

i can confirm that the menu item was removed in the recent OS versions.
i check for the menu item and use event injector if it is not present.
----------------------------------------------------------
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: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: Programmatically reject a call

Thx for the update Simon.



"Listen carefully, I shall say this only once"
New Developer
Posts: 27
Registered: ‎04-09-2009
My Device: Not Specified

Re: Programmatically reject a call

My sincere thanks to mantaker, myraddin and Simon for responding to this months old thread.
 

Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: Programmatically reject a call

Anytime mate Smiley Happy

 

Now if only Devguy could resolve the thread ... If it pleases him, of course  Smiley Wink



"Listen carefully, I shall say this only once"