Nearby Connections API sendPayload as stream stops in the middle of stream
Dear All,
I am using Nearby Connections to transmit and receive data between two Pixel 2 phones and follow guideline in the formal page ..
My input is a byte array of Y plane from the camera frame of size 300KB. Then I convert it to InputStream using
InputStream yStream = new ByteArrayInputStream(yBytesArray);
and send this stream as payload.
When I log update in onPayloadTransferUpdate(), I see that the sender stops sending when ~150KB are sent. Also, the receiver only gets ~50KB and then stops, without returning the state "SUCCESS".
I have tried changing strategy to STAR and POINT_TO_POINT but it doesn't help. Anyone has any idea how I can fix this. Thank you.
Patrick
I observed that after sending 157080 bytes (number from update.getBytesTransferred ()), the Nearby connection gets disconnected. From the same transmission, the receiver receives only 59136 bytes (number from the same method call).
After I make InputStream yStream a global parameter, I can have the sender send the entire byte array. However, the receiver still is able to receive only 59,136 bytes. I would appreciate any advice on this.