12-03-2010 05:31 PM
I have implemented the client side of push functionality in my BlackBerry app. I am successfully registering, and I am getting push alerts in my onMessage() handler. My problem is that I am unable to read the data from the PushInputStream.
I have not found any examples on how to do this, here is the code I have right now:
12-17-2010 04:21 AM
check the PushMessageReader from the sample app.
it uses a bigger buffer
private static byte buffer = new byte[15 * 1024];
checks the message header, and, for a textmessage uses
int size = pis.read(buffer);
binaryData = new byte[size];
System.arraycopy(buffer, 0, binaryData, 0, size);
PushMessage message = new PushMessage(msgId, System.currentTimeMillis(), binaryData, true, true);
personally i use IOUtilities to read inputstreams, but in this case i just took the code as it is.