This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Connect Mobile 4.40 makeImageRequest localhost error

Hello, I have a small Garmin app, that connects to my Android phone who has a running http server that serves png images by url get encoding: Example 127.0.0.1:9977/


So far, everything was working like a charm, but after updating to Android Garmin Connect Mobile 4.40 it stop working. The makeImageRequest returns a BLE_HOST_TIMEOUT as a responseCode and never downloads the image. Also debugging the Android http server, never receives the request for any picture. (Other requests such as webRequests are properly received as explained bellow, but not imageRequest)


   // Set up the responseCallback function to return an image or null
    function responseCallback(responseCode, data) {
        responseCode = responseCode;
        if (responseCode == 200) {
            image = data;
        } else {
           System.println(Lang.format("Error code $1$",[responseCode]));
           image = null;
        }
    }

    // wrap the request in a function
    function requestImageinGallery(imageId) {
        var url = "http://127.0.0.1:9977/";           // set the image url
        var parameters = { "imageId" => imageId};     // set the parameters
        var options = {                                         // set the options
            :palette => [ Gfx.COLOR_ORANGE,                     // set the palette
                          Gfx.COLOR_DK_BLUE,
                          Gfx.COLOR_BLUE,
                          Gfx.COLOR_BLACK ],
            :maxWidth => 200,                                   // set the max width
            :maxHeight => 200,                                  // set the max height
            :dithering => Communications.IMAGE_DITHERING_NONE   // set the dithering
        };

        // Make the image request
        Communications.makeImageRequest(url, parameters, options, method(:responseCallback));
    }

 
 


The makeWebRequest works perfectly and receives the response from the the httpServer as is running.

 
  function checkIfServerIsRunning() {
      
  var url = "http://127.0.0.1:9977/";           // set the image url
  var params = { "check" => "isAlive"};     // set the parameters

   var options = { // set the options
    :method => Communications.HTTP_REQUEST_METHOD_GET, // set HTTP method
    :headers => { // set headers
    "Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON}, // set response type
    :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON };
    
    Communications.makeWebRequest(url, params, options, method(:onReceive)); }




Can anyone help me?


Thank you in advance.

Top Replies

All Replies

  • Don't understand how your linked issue is related Jim. 

    However, that is known fact that image needs to be sent to internet by Garmin Connect app for processing. Which is highly impractical for lots of use-cases but that is another problem. 

    The real question is why this stopped to work with 4.40 of Garmin Connect Android app. 

  • If Jim's theory is correct, prior to 4.40 GCM Android would process the images locally within the app and did not need the internet to process the image.  If GCM Android 4.40 switched to use the same common infrastructure that IOS and WiFI/LTE connected devices use, then the image download would require access to the internet.  The bug report that Jim linked is how we found out that GCM Android handled images differently than IOS or direct connected devices.

  • My theory is that the images aren't set to the internet.  They need to be available on the internet and the garmin server pulls them from there.  That's why localhost no longer works, but if the images are on the net, they do.

  • Even previously loading images from localhost required active Internet connection. 

    We (developers) didn't change anything and previously worked solution is broken now. So only valid next step is to get info from Garmin team what was changed.. I don't know why there is always tons of discussion whether something is bug or not. Not related now. 

  • GCM itself requires an active data connection for about anything. Images or not. Without one it can't do much.

    As far as getting info from Garmin, that's why I "at'ed" Travis a few posts back.

  • Hmmm.. so is it bug or new "feature"

    Please give us info if our apps have changes to work again or not. I have thousands of paying customers to answer to. Thanks. 

  • Yeah, what worked before is suddenly broken and it's been 2 days without any response from Garmin. How can developers keep working on any useful app if this kind of stuff keeps on popping up?

    My app is the same as yours: an android app serving http image content at localhost and the watch app reads the image from it. 

  •  is 100% correct here.

    All images must be converted to a device-compatible format before they are displayed on device. We have always had a web service for this, and for some reason GCM/Android wasn't using it. It is my understanding that GCM/Android was updated to remove the built-in image conversion code, and start using the web service as GCM/iOS and other bits of our system do.

    This change was made intentionally so that we would not have to roll a new GCM/Android release in order to add support for new devices. We can roll a small tweak to the service and all clients of the service will be able to properly support them.

    It is not my decision to make as to whether or not this is a bug. It looks like the issue has already been filed. I've added some comments to the issue.

    Please follow any new developments on the bug report at:

    https://forums.garmin.com/developer/connect-iq/i/bug-reports/connect-mobile-4-40-makeimagerequest-localhost-error

  • I'm closing this thread and marking Travis' explanation as the answer for now. Additional conversation can take place on the bug report at:

    https://forums.garmin.com/developer/connect-iq/i/bug-reports/connect-mobile-4-40-makeimagerequest-localhost-error