BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-13-2007, 07:28 AM   #1 (permalink)
New Member
 
Join Date: Nov 2007
Model: 8100P
PIN: N/A
Carrier: None
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with platformRequest

Please Login to Remove!

hello,

i have developed a j2me application, and i'm trying to execute it in a BlackBerry pearl 8100. The application run ok in the blackberry but i have calls to Midlet.platformRequest(url) in the code and don't run in the blackberry. This calls are made from an Thread. Doing probes i see that if i call platformRequest directly the call runs ok, but if i do the call from an thread not. Because is this? is possible call platformRequest from an thread? i need do this.

Thanks.
Offline  
Old 01-15-2008, 04:17 AM   #2 (permalink)
New Member
 
Join Date: Oct 2007
Location: Barcelona
Model: many
PIN: N/A
Carrier: many
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

I do have the same problem:

A platformRequest works fine from the canvas.keypressed, but does not work from a thread.


I'm interested in all informations/suggestion relative to this problem.

thanks,

Loda


Extra Tech info:

"RuntimeException: pushModalScreen called by a non-event thread" thrown from the thread.

solution as explained here (getEventLock, invokeLater):
BlackBerry - BlackBerry | Wireless Handheld Devices, Software & Services from Research In Motion (RIM)
did not work

Last edited by Loda : 01-15-2008 at 05:41 AM. Reason: add Extra Tech info
Offline  
Old 01-16-2008, 06:06 AM   #3 (permalink)
New Member
 
Join Date: Oct 2007
Location: Barcelona
Model: many
PIN: N/A
Carrier: many
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found a "solution"...

1. in the thread,
- I push in a "queue" (in fact a var) the parameter of the request.
- I call a repaint of the active canvas

2. in the paint of each canvas, I pop the request

3. I process the request with

public void DoPlatformRequest(String rqt){

final String r = rqt; // for.run() methode

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) {
TraceEx("DoPlatformRequest (" + r + ") fail. ",ex);
}}
});

}


its looks like having net.rim.device.api.system.Application.isEventDispa tchThread()==true is not enough to call the platform request.


I hope this helps.

Loda
Offline  
Old 07-28-2008, 09:33 AM   #4 (permalink)
New Member
 
atleta's Avatar
 
Join Date: Jul 2008
Model: 8310
OS: v4.22176
PIN: N/A
Carrier: PannonGSM
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default This is indeed a bug

Hi,

I just found this same problem when testing a midlet on a 8310. I moved my platformRequest call to a new thread hoping that it might solve a problem with the confirmation alerts on a SonyEricsson. LOL But this move made things brake on the blackberry. When I call platformRequest the device will pop up an alert asking the user if they wants to allow this (calling a phone number in my case) and this makes the underlying libs throw this exception.

This however is a bug in the blackberry MIDP implementation as the MIDP spec allows calling platform request from any thread, and as a matter of fact it allows UI operations outside of the event thread. The blackberry MIDP implementation should take care of all this.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.