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

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 105
Registered: ‎09-06-2013
My Device: Z10

Get email attachment download status (without activating download), is there a IsDownloaded method?

As above, is there a way to check if email attachment has been downloaded? I do not want to download it if it hasnt been downloaded yet. 

Currently the Attachment.data downloads the attachment if it has not been downloaded yet.

I know there is a downloadstatus signal, but that is used when the download has been initiated.

 

There is a AttachmentDownloadStatus class, so is there a way to get that status without forcing the download?

Retired
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: Get email attachment download status (without activating download), is there a IsDownloaded method?

The Message->attachments() method will give you a list of Attachment objects without downloading them.

 

See http://developer.blackberry.com/native/reference/cascades/bb__pim__message__message.html#function-at...

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Developer
Posts: 105
Registered: ‎09-06-2013
My Device: Z10

Re: Get email attachment download status (without activating download), is there a IsDownloaded method?

I need to know if they have been downloaded or not, if downloaded, backup them, if not ignore

Retired
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: Get email attachment download status (without activating download), is there a IsDownloaded method?

OK

 

There are signals emited when an attachment is downloaded or its status changes.

 

http://developer.blackberry.com/native/reference/cascades/bb__pim__message__messageservice.html#func...

 

The use of AttachmentDownloadStatus is not at all clear from the documentation so let me look into that and report back.

 

Regards

 

Martin

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Retired
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: Get email attachment download status (without activating download), is there a IsDownloaded method?

OK, the only way to establish the status of an Attachment is via the signals in the MessageService class. You can see percentage downloaded is a parameter to the attachmentDownloadStatusChanged signal for example.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Developer
Posts: 105
Registered: ‎09-06-2013
My Device: Z10

Re: Get email attachment download status (without activating download), is there a IsDownloaded method?

I found two ways of retrieving attachments

1. Using Message::attachments()

 

Returns QList<Attachment>

This method retrieves attachments for the message.

Only way to check downloaded status is through downloaded signal, but i want to check if message has been downloaded without activating download.

 

None existent IsDownloaded method

 

2. Using MessageService::attachments()

 

Returns QList<FileAttachment>

This method retrieves attachments for all messages in current conversation.

 

calling FileAttachment::downloadPath will return empty QURL if attachment has not been downloaded and thus can be used as a way for me to check if attachment has been downloaded without activating download.

 

However, as all attachments for conversation is retrieved, I would have to loop through all attachments and check messageid before saving them, my thoughts are would there be a performance hit if conversation has many attachments? The is a filter when using MessageService::attachments but no filter for messageID.

Seems like the 2 classes are more or less the same but just the scope of retrieving attachments and some methods. Any advice?

Retired
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: Get email attachment download status (without activating download), is there a IsDownloaded method?

I don't imagine performance would be a significant issue but the only way to be sure is to test with real data so I suggest you do just that.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Highlighted
Developer
Posts: 105
Registered: ‎09-06-2013
My Device: Z10

Re: Get email attachment download status (without activating download), is there a IsDownloaded method?

i found the availableSize and totalSize methods for the Attachment class,

 

the docs say it is used to see if attachment has been downloaded, therefore I do a check for

 

if (attachment.availableSize == attachment.totalSize)

 to see if attachment has been downloaded. Currently waiting for device to test (again haha)