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
Pepper_91
Posts: 1
Registered: ‎08-08-2008
My Device: Not Specified

Problems making calls with platformRequest("tel:666666666")

Hello:

I've developed an application in J2ME with Netbeans. It runs Ok in all phones, but when i recompiled the .jar to obtain the .cod, the application runs ok in Blackberry (8120) excepts for a command that i called "Call" that runs:


private void callMaker() {

boolean mustExit;

 try {

      mustExit = this.platformRequest("tel:902222222");

      if (mustExit) {

      this.destroyApp(true);
      this.notifyDestroyed();
 }

} catch (Exception e) {/*e.printStackTrace();*/}
}

 

Why?

Please use plain text.
Developer
Christophe
Posts: 39
Registered: ‎07-21-2008
My Device: Many
My Carrier: Many

Re: Problems making calls with platformRequest("tel:666666666")

[ Edited ]

hi,

 

 I did have a smilar problem when calling the platformrequest from a thread (MIDlet based application).

 

 

you may try the following:

 

// Explaination: added cause the platformRequest did thrown an exception
// "RuntimeException: pushModalScreen called by a non-event thread"
// when called from a thread (cause is not the BB event thread)
UiApplication.getUiApplication().invokeLater(
new Runnable() {
public void run() {
try {
platformRequest(r);
//We assume that BB Device don't need to close the Midlet in order to process a phone call / web browser.

} catch (Exception ex) {
}}
});

 

MUST be called from the main thread (I call it from the canvas.repaint) (you may want to implement a queue system)

 

 

oh, and this could be useful:

 

DoPlatformRequest(rqt, !net.rim.device.api.system.Application.isEventDispatchThread()); /* net.rim.device.api.system.Application.isEventDispatchThread() == true * from thread Draw/KeyPressed, but not from other thread. */

 

 

 

hopes this helps,

 

 

Message Edited by Christophe on 08-08-2008 10:38 AM
Please use plain text.