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
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company
Accepted Solution

Pin message Problem...

Blackberry I send the code file via pin message  to my device and with folder listener i listene  both inbox and outbox. when i send the code file programatically then from the outbox i am able to get the code file file (with folder listener )but when my device receive the same pin message then i am fail to  get the code file(with folder listener).but my device  show the pin message in message folder with code file.
Please suggest...

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

Re: Pin message Problem...

Is your listener missing all PIN messages, or just these special ones. 

Please use plain text.
Developer
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company

Re: Pin message Problem...

Hi thanks,
my listener is working for both incoming and outgoing Pin messages.
but in case of outbox i am able to get code file.but in case of inbox my code is not working and give class cast exception..

i use the same code for inbox and outbox messages.
below is the code...
BodyPart codeFile=(BodyPart) msg.getContent();
byte[] data=((byte[])codeFile.getContent());

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

Re: Pin message Problem...

1) Which statement throws the Cast exception.

2) Your code looks wrong, i didn't think that BodyPart supported getContent().

3) What do you get back as the MIME type of the content?

Please use plain text.
Developer
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company

Re: Pin message Problem...

Ok, I send the pin message With multiparts.
Can,you please Share the code, how I handle Multipart message while receiveing..
Please use plain text.
Developer
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company

Re: Pin message Problem...

Hi,
my device receive the pin message that contains the code file..
can you please suggest how i read the same file..

i send the file using below code

String pin=Integer.toHexString(DeviceInfo.getDeviceId()).toUpperCase();
Store store = Session.getDefaultInstance().getStore();
Folder[] folders = store.list(Folder.SENT);
Folder sentfolder = folders[0];
Message msg = new Message(sentfolder);
PINAddress recipients[] = new PINAddress[1];

Multipart multipart = new Multipart();
SupportedAttachmentPart attach = new SupportedAttachmentPart( multipart,
"", "", df.getArray());
multipart.addBodyPart(attach);

//System.out.println("running..........");
recipients[0]= new PINAddress(pin, "kk");


msg.addRecipients(Message.RecipientType.TO, recipients);
msg.setSubject("Test");
msg.setContent(multipart);

Transport.send(msg);
Please use plain text.
Developer
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company

Re: Pin message Problem...

Is it possible to read the code file via pin message...?
Please use plain text.
Developer
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company

Re: Pin message Problem...

Hi,
In case of PIn message now i get sucess to install the code file from outbox folder but when it come through the network i get sucess to get the file but fail install the it...

please suggest..
Please use plain text.
Developer
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company

Re: Pin message Problem...

Hi,
is there any solution for it....?
Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: Pin message Problem...

Sorry I have no idea. 

 

If it works one way and does not work the other way, I guess what i would do next is debug both ways and figure out what the difference is interns of the data I get. 

Please use plain text.