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 http://127.0.0.1:9977/?imageId=9154752
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?
PS: I did create a small webserver ngnix/node.js online to test it, with the same configuration as my android HttpServer. And accessing it by IP, same as above with (just changing the ip), with same port number, and request parameters, it works perfectly. There must be something with 127.0.0.1 that is blocked (I also tested with http://localhost, and does not work either).
Thank you in advance.