Sending large data over SAP?

I’m trying to send large data (1MB) over SAP from Android to Tizen, but it feels too slow:

Log.d(TAG, "SEND START"); 
try {
  MySASocket.secureSend(getServiceChannelId(0), data.getBytes());
} catch (Exception ex) { ex.printStacktrace(); }
Log.d(TAG, "SEND END");

If I try sending a large data (around 1.0-1.2Mb), first attempt seems succeed:

Log contains:

SEND START
SEND END

However, next attempt seems stucking in secureSend, and will wait in that until Gear disconnects.

Gear during this block can send data back to host.

What shall be my solution here?

Here are some timings:

SEND START
---3 second ellapsed
SEND END
---30 second ellapsed
sap_socket_data_received_cb called on Gear

Is this normal?

Can I improve this while keeping the security?

Hello danergo,
Did you invoke this method in the main thread of the application? As you’re sending large data file which may create long latency, I would like to suggest you to make a separate thread to do this task.
Also please do a safe check with the data limits with SAPeerAgent.getMaxAllowedDataSize() API before sending large amount of data.

Thank you.

Hi, @ssaha.

Of course, I’m sending it over a separate thread, and data size is below max allowed.