Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>We will have to: </p> <ul> <li>start call</li> <li>hold call</li> <li>start new call</li> <li>join conference ...</li> </ul> <p>To start call see api from <a href="https://stackoverflow.com/questions/1453164/blackberry-make-a-call-from-native-address-book">Blackberry - make a call from native address book</a><br> There is no api to hold and join but we can use <a href="https://stackoverflow.com/questions/1533057/blackberry-run-menu-item-from-dialer-phone-app">Blackberry - run menu item from dialer Phone App</a> technique<br> To bring app screen back foreground we can use code from <a href="https://stackoverflow.com/questions/1984524/blackberry-create-an-application-which-will-lock-another-application-event">Blackberry - Create an application which will lock another application event</a></p> <p>Full code: </p> <pre><code>class Scr extends MainScreen implements PhoneListener { private static final String STR_MODULE_NAME = "SOConferenceCall"; EditField mPhoneNumber = new EditField("phone number: ", "12345"); boolean mConnected = false; Vector mPhoneCalls = new Vector(); public Scr() { Phone.addPhoneListener(this); add(mPhoneNumber); } protected void makeMenu(Menu menu, int instance) { super.makeMenu(menu, instance); if (isCalling()) { menu.add(new MenuItem("add to conference", 0, 0) { public void run() { holdActiveCall(); makeCall(mPhoneNumber.getText()); } }); } else { menu.add(new MenuItem("call", 0, 0) { public void run() { makeCall(mPhoneNumber.getText()); } }); } } private void holdActiveCall() { runMenuItem("Hold"); } private void joinCalls() { runMenuItem("Join Conference"); } private void makeCall(String number) { PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL, number); Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call); } private void runMenuItem(String menuItemText) { Screen screen = Ui.getUiEngine().getActiveScreen(); Menu menu = screen.getMenu(0); for (int i = 0, cnt = menu.getSize(); i &lt; cnt; i++) if (menu.getItem(i).toString().equalsIgnoreCase(menuItemText)) menu.getItem(i).run(); } protected int switchToForeground() { int id = -1; ApplicationManager appMan = ApplicationManager.getApplicationManager(); ApplicationDescriptor appDes[] = appMan.getVisibleApplications(); for (int i = 0; i &lt; appDes.length; i++) { Sreing name = appDes[i].getModuleName(); if (name.equalsIgnoreCase(STR_MODULE_NAME)) { id = appMan.getProcessId(appDes[i]); appMan.requestForeground(id); // give a time to foreground application try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } break; } } return id; } private boolean isCalling() { return mConnected; } public void callAdded(int callId) { switchToForeground(); } public void callAnswered(int callId) { switchToForeground(); } public void callConferenceCallEstablished(int callId) { switchToForeground(); } public void callConnected(int callId) { if (mPhoneCalls.size() == 0) mConnected = true; else joinCalls(); mPhoneCalls.addElement(Phone.getCall(callId)); switchToForeground(); } public void callDirectConnectConnected(int callId) { switchToForeground(); } public void callDirectConnectDisconnected(int callId) { switchToForeground(); } public void callDisconnected(int callId) { mPhoneCalls.removeElement(Phone.getCall(callId)); if (mPhoneCalls.size() == 0) mConnected = false; switchToForeground(); } public void callEndedByUser(int callId) { switchToForeground(); } public void callFailed(int callId, int reason) { switchToForeground(); } public void callHeld(int callId) { switchToForeground(); } public void callIncoming(int callId) { switchToForeground(); } public void callInitiated(int callid) { switchToForeground(); } public void callRemoved(int callId) { switchToForeground(); } public void callResumed(int callId) { switchToForeground(); } public void callWaiting(int callid) { switchToForeground(); } public void conferenceCallDisconnected(int callId) { switchToForeground(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload