I am getting 402 error code from below code. 402 is NETWORK_RESPONSE_TOO_LARGE ?
If yes.. is there any other way to read this response ? It has 2MB of size. Garmin has 100MB of ram yes ? Is it because I have no space left on my device and could clear some unnecessary data ? Or is it prohibited by the API ? Or maybe the background ServiceDelegate invoking the requests is limited by memory ? Maybe I could stream the content somehow ? I would love to have lineIterator like in Java. I don't need the whole file, just to find correct lines and store in memory. I didn't know how to do that, so I am downloading whole file for further processing. On the other hand 2MB is not big size... why there is a problem.. What is the maximum size of response? Can I rewrite the code somehow to accept bigger size ?
(:background)
class WebRequestDelegate extends Toybox.System.ServiceDelegate
function makeRequest() {
Sys.println("makeRequest :)");
// notify.invoke("Executing\nRequest");
try {
Comm.makeWebRequest(
"someaddresswith2mbarray",
null,
{
"Content-Type" => Comm.REQUEST_CONTENT_TYPE_JSON
},
method(:onReceive)
);
} catch (e instanceof Lang.Exception) {
Sys.println(e.getErrorMessage());
}
}
function onReceive(responseCode, data) {
Sys.println("onReceive :)"+responseCode);
}