How to save a downloaded gpx onto the device?

Former Member
Former Member

Hi there

I am quite new to Monkey C and the Connect IQ SDK. I would like to download some GPX files onto the devices persisted storage.

This is what i have got right now:

function downloadWorkoutSummary() {
    var url = "https://f.hikr.org/files/gps49112.gpx";
    
       var params = {                                              // set the parameters
              "definedParams" => "123456789abcdefg"
       };

       var options = {                                             // set the options
           :method => Communications.HTTP_REQUEST_METHOD_GET,      // set HTTP method
           :headers => {                                           // set headers
                   "Content-Type" => Communications.REQUEST_CONTENT_TYPE_URL_ENCODED},
                                                                   // set response type
           :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_GPX
       };
    

    try {
      Comm.makeWebRequest(url, params, options, method(:onDownloadWorkoutSummaryResponse));
    } catch (e) {
      System.println("Error");
    }
  }

  function onDownloadWorkoutSummaryResponse(responseCode, data) {
    System.println("Got Response");
    System.println(responseCode);
    System.println(data.toString());
  }

I get 200 as Response code. Therefore the download works as expected, but i cant find the Content on my (simulated)device.

If i click on: File -> Edit persistent storage

The simulator tells me that there is nothing stored.

Any ideas?

Thanks.