DanielBlomberg1 / mimir

Android app for logging various sensors data in smart devices.
Apache License 2.0
0 stars 0 forks source link

Find out how to send files larger than 150mb from watch to smartphone #12

Closed danmida closed 4 days ago

danmida commented 2 weeks ago

At the time of testing, somewhere between 150mb to 200mb is a current limit to sending a file from watch to smartphone before emulator watch crashes.

Error log states watch device is out of memory.

Customer stated that log data could potentially be in hundreds of megabytes. Potentially, they could work around the limitation of file size.

Compress the log on watch and decompress on phone?

My original thought is to chunk the files.

danmida commented 2 weeks ago

Was able to optimize checksum so that instead of being able to send 150mb files on emulator watch, I was able to send 300mb file before running into device out of memory error with larger files.

This limit may be lower on real physical watches.

Anything higher than the limit requires editing transfer protocol. for example sending in chunks, compressing data etc.

danmida commented 2 weeks ago

I tested the first commit that had working file transfer to test out if checksum function have any more memory impact.

I managed to send 300mb file with success. 400mb file failed to go through, with same out of memory error.

danmida commented 4 days ago

The way on how the file is processed/streamed/read/etc had a big memory impact. The whole file was loaded into memory which in turn would cause watch to crash on very large files.

I optimized the code to process the file as chunks and sent to phone. It does not seem that any code changes was required for phone side fortunately.

I tested sending with 1 gigabyte file and it seems to work. On one random case, the smartphone app crashed on me but it seemed to be a rare occurence as it happened only once.