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
Developer
jonberry
Posts: 484
Registered: ‎07-17-2008
My Device: Not Specified

Re: Possible bug in OS 5.0 with SendListener?

Are there any errors in the log?

 

Have you tried this on an actual device with a newer OS version?

 

Have you considered using a DialogClosedListener?

Please use plain text.
Developer
Posts: 69
Registered: ‎10-27-2008
My Device: Not Specified

Re: Possible bug in OS 5.0 with SendListener?

There are no errors in the logs, just the device freezes.  A DialogClosedListener won't work -- the Runnable never gets executed, so the Dialog never gets displayed.

 

Haven't tried it on an actual device (myself) but everybody that has my software on OS 5.0 says that outgoing emails do not work (as I intercept them with the SendListener).

 

 

Matty

Please use plain text.
Developer
jonberry
Posts: 484
Registered: ‎07-17-2008
My Device: Not Specified

Re: Possible bug in OS 5.0 with SendListener?

What happens if you change getEventLock to getAppEventLock in the sync block?

 

Personally, I've had best results using a DialogClosedListener with global screens.

 

Since you mentioned that you were able to display the screen using the code in the KB, I would combine that method with a DialogClosedListener to see if you can get the result.

Please use plain text.
Developer
Posts: 69
Registered: ‎10-27-2008
My Device: Not Specified

Re: Possible bug in OS 5.0 with SendListener?

It's only able to display the screen in the KB articles because the ones there don't wait for a response.  What happens is the invokeLater is executed and doesn't block, so the SendListener continues on its merry way.  Once it's has completed and returned from the SendListener, the invokeLater is THEN run (which is too late, as I depend on that Dialog's response on determining what the SendListener should do).

 

The issue is that the invokeAndWait blocks and the Runnable inside of it never gets run -- this is causing the device to freeze inside the mail app (but I can enter the ribbon and go to another app or desktop).  Again, the DialogClosedListener won't work in this instance because the response from the Dialog is needed for the SendListener response (i.e.: the Dialog doesn't get shown, so the DialogClosedListener would never get run.  I would need to block for it anyways, before the SendListener could return a boolean from sendMessage).

 

But thanks for trying to think of a solution.  :smileyhappy:

Matty

 

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: Possible bug in OS 5.0 with SendListener?

Initially I agreed that you could not, but in fact I think you might be able to use DialogClosedListener.  But I have been checking on other things, and I note that in OS 4.2.1 and OS 5.0, the listener is called from a UiApplication.  However in OS 5.0 it is not called with the Event Thread, but is in OS 4.2.1.  I'm working on this to see detecting this and processing differently provides the answer.  However I wonder if anyone else would like to try another OS and see if the listener is running with the Event Thread.

 

        Application ourapp = Application.getApplication();
        System.out.println("In Event: " + ourapp.isEventThread());
        System.out.println("IS UiApplication: " + (ourapp instanceof UiApplication));

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: Possible bug in OS 5.0 with SendListener?

[ Edited ]

I think I've made some progress here.

 

Don't know if you have ever seen this KB article:

 

How to - Detect a deadlock using the JDE
Article Number: DB-00572
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800901/How_To_-_Detec...

 

Well I just tried this on OS 5.0 and got the following:

 

"

Interlaced sync objects:
    Synch object A: @06884800 - java.lang.Object
    Synch object B: @041F2400 - net.rim.device.api.collection.CollectionLock
 

This thread:
    synchronized( B ): EmailMessageSender.run(  ) [source code is not available]
    synchronized( A ): MySendListener.sendMessage( Message ) [ourUiApp.pushGlobalScreen( dialog,]
 
Some other thread in the past (no stack available):
    synchronized( A ): Application.doProcessNextMessage( Message ) [source code is not available]
    synchronized( B ): MessageListUI.isSeparator( int ) [source code is not available]

"

 

This locked up on the synchronize for the Event Lock.  To me, this suggests that some other Thread has the Event Lock, and is waiting for this Thread to finish and free up a lock, but we can't finish until we know whether to send it or not, and to do that we need the Event Lock.  We are screwed. 

 

I think you will have to raise this on issue tracker. 

Please use plain text.
Developer
Posts: 69
Registered: ‎10-27-2008
My Device: Not Specified

Re: Possible bug in OS 5.0 with SendListener?

Posted this on the issue tracker two weeks ago.  What's the general timeframe on hearing something back about it?  It's still in 'Triage' state and I haven't heard anything.

 

(Issue at https://www.blackberry.com/jira/browse/JAVAAPI-771 for anyone to see.)

 

 

Matty

 

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Possible bug in OS 5.0 with SendListener?

I think it has to do with priority, I have 2 low priority entries that where last "updated" months ago.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
Posts: 69
Registered: ‎10-27-2008
My Device: Not Specified

Re: Possible bug in OS 5.0 with SendListener?

Priority is "Blocker", for the obvious reason that the bug causes my application to freeze the device with a deadlock.  At least now it's been assigned, but I still see no progress on it -- it's still in "Triage".

 

Matty

 

Please use plain text.
New Developer
vamshee
Posts: 2
Registered: ‎02-04-2010
My Device: 9700
My Carrier: AT&T

Re: Possible bug in OS 5.0 with SendListener?

I have a very similar application trying to capture user response to an alert displayed by my application in SendListener SendMessage() function.

The code works fine on 4.2 to 4.6 devices. Just started testing it on 9700 (OS5.0) and it doesn't work.

 

Regards,

vamshee

Please use plain text.