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
Contributor
jgobert
Posts: 22
Registered: ‎08-22-2012
My Device: Bold 9900

Re: App crashing when accessing email attachment...

I could be totally reading this wrong... but is the code deleting the message before posting the global event through ApplicationManager? If so, is it trying to post the message contents into that event for a message that has already been deleted?

I'm referring to the if block near the end where, if conditions are true, a message is written "Received Precision Message!!!", then message is marked as opened, and then the deleteMessage function is called on the message. The next line after that is for the ApplicationManager event post calling the same message that was just deleted..?
Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: App crashing when accessing email attachment...

[ Edited ]

remove these lines:

 

// [DNT] 09/26/09 - Item#1.5
message.setFlags(Message.Flag.OPENED);
//message.setFlags(Message.Flag.OPENED | Message.Flag.DELETED);
messageFolder.deleteMessage(message);

 

and move them into the globalEventReceived method. 

----------------------------------------------------------
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
Contributor
jgobert
Posts: 22
Registered: ‎08-22-2012
My Device: Bold 9900

Re: App crashing when accessing email attachment...

This is all the original code... I haven't modified anything yet... I've been trying to make sense of it first :smileyhappy:

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: App crashing when accessing email attachment...

[ Edited ]

OK, it looks like the code you posted previously is actually already being run in your app context. 

 

The code that is being run in the Listener is just the

messagesAdded(..)

method from your IncomingMail.

 

So I think the delete we see that causes the problem is actually the one in there.

 

messageFolder.deleteMessage(message);

 

So you can try what i suggested yesterday, which is to comment the delete out and see if the failure continues to happen.

 

I suspect it won't. so all you have to do is move the delete (and the 'OPEN' marking I suggest) into your global handler. 

 

Edit:

A lot can happen while you are gettign a cuppa I see...  Ah well, at least we all agree!

Contributor
jgobert
Posts: 22
Registered: ‎08-22-2012
My Device: Bold 9900

Re: App crashing when accessing email attachment...

Sorry I should have posted an update after your earlier reply about commenting out the messageFolder.deleteMessage(message); line. I did do that and tested but got the same errors. I'm about to re-test with commenting out the two lines in the IncomingMail.java code as well. Will post back asap.
Contributor
jgobert
Posts: 22
Registered: ‎08-22-2012
My Device: Bold 9900

Re: App crashing when accessing email attachment...

I'm starting to think Blackberry doesn't like me much... I made the changes to the code, repackaged and deployed on my test phone.  I'm now getting a pop-up when I try to open the GUI that states:  Application terminated:  Precision Collector has been denied the "Cross Application Communication" permission.  I didn't change anything other than the version number (bumped up by 1) and I commented out the lines we discussed....

 

I'm uninstalling now so I can reinstall and see if it happens again....  Good times :smileyhappy:

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: App crashing when accessing email attachment...

That one is defined in the application permissions (or application control policy if you are still using the BES).  To modify it go to Options -> Applications -> select your app and choose Edit Permissions.

 

If you are using javaloader to load from a command line, specify the JAD file instead of COD files.  Loading COD files directly can cause these types of permission errors.  Or if you are using the BlackBerry Java Plug-in for Eclipse you can right click on the project and choose BlackBerry -> Load on device.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: App crashing when accessing email attachment...

[ Edited ]

Options (spanner icon) --> Device -- Application Management (you might have to scroll to find this).  Look for your app.  click on it, then Edit Permissions.  You should be able to change the permissions. 

 

Edit: Quck draw Mark......

Contributor
jgobert
Posts: 22
Registered: ‎08-22-2012
My Device: Bold 9900

Re: App crashing when accessing email attachment...

I did... all were set to allow.
BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: App crashing when accessing email attachment...

How was the application installed?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker