I've created a widget, and making a webRequest in the simulator is always giving me a -400 responseCode.
Please help! My code is below. I have <iq:permissions><iq:uses-permission id="Communications"/></iq:permissions> in the manifest...
class MyMenuInputDelegate extends WatchUi.MenuInputDelegate { function initialize() { MenuInputDelegate.initialize(); } function onMenuItem(item) { if (item == :one) { System.println("making req"); makeRequest(); } else if (item == :two) { System.println("Item 2"); } } // set up the response callback function function onReceive(responseCode, data) { if (responseCode == 200) { System.println("Request Successful"); // print success setBehaviorString("Request Successful"); } else { System.println("Response: " + responseCode); // print response code System.println(data); setBehaviorString("Request failed: " + responseCode); } } function makeRequest() { var url = "https://helloacm.com/api/random"; // set the url var params = { // set the parameters "n" => "128" }; 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_URL_ENCODED }; var responseCallback = method(:onReceive); // set responseCallback to // onReceive() method // Make the Communications.makeWebRequest() call Communications.makeWebRequest(url, params, options, method(:onReceive)); } } ... class widget1Delegate extends WatchUi.BehaviorDelegate { function onSelect() { onMenu(); return false; } function onMenu() { var menu = new WatchUi.Menu(); var delegate; menu.setTitle("My Menu"); menu.addItem("Item One", :one); menu.addItem("Item Two", :two); delegate = new MyMenuInputDelegate(); // a WatchUi.MenuInputDelegate WatchUi.pushView(menu, delegate, WatchUi.SLIDE_IMMEDIATE); return true; } ...