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

Posts: 41
Registered: ‎09-27-2010
My Device: Not Specified

attachment not received as it is in blackberry device

[ Edited ]

I followed the below link and add one audio file as attachment is .amr file which is playing well in windows media player ofcourse I am giving different file name in attachment.

after sending a mail with this attachement receiver is not able to play in media player after playing few seconds showing dialog "Windows Media Player cannot play the file. The file is either corrupt or the Player does not support the format you are trying to play." 


I am not getting what is happening is it because of different file name


Please help me If any one faced this kind of issue. 




here is the code segment :


UiApplication.getUiApplication().invokeLater(new Runnable()
public void run()
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(getMessage(filepath)));



public Message getMessage(String filePath){
//create a multipart
Multipart mp = new Multipart();

String messageData = getMessageBody();

TextBodyPart tbp = new TextBodyPart(mp,messageData);

//add the file to the multipart

if (filePath.length()>1){
// byte[] fileData = getFileData(filePath);

String filename =filePath.substring(filePath.indexOf('-')+1, filePath.indexOf('_'));
filename = filename+".amr";
SupportedAttachmentPart sap = new SupportedAttachmentPart(mp,"amr/wav",filename,fileData);

//create a message in the sent items folder
Folder folders[] = Session.getDefaultInstance().getStore().list(Folder.SENT);

Message message = new Message(folders[0]);

//add recipients to the message and send
try {
message.setSubject("Voice Recording");

// Transport.send(message);
} catch (Exception e) {
return message;



Posts: 17,003
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: attachment not received as it is in blackberry device

only attachments with the x-rimdevice prefix are downloaded to the BB.
since 5.0 you can use attachmentdownloadmanager for other attachments.

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