Ticket Created
over 4 years ago

PHIL-627

Transferred

Edge Explorer 1000 FW 9.30 reporting it "has" connectionAvailable on device only.

I recently got contacted by a user of my widget who has an Edge Explorer 1000 who reported that after a recent update the widget that the widget always reported that the widget needed a connection to the phone.  The user reported that other CIQ apps had no problem detecting the phone connection but for some reason, mine does not.  In working with the user I have provided him a test build which writes a log file.  In a recent build I implemented the following function to try and better support devices with either an available LTE or WiFi connection.  This code sample has the additional debug checks included.

	function isConnectionAvailable() {
        System.println("fctns fctn isconnavailable");
		var info = System.getDeviceSettings();
       	System.println("info phoneConnected status: " + info.phoneConnected);
		if ( info has :connectionAvailable) {
        	System.println("info connectionAvailable");
	       	System.println("info connectionAvailable status: " + info.connectionAvailable);
			return info.connectionAvailable; //CIQ versions >= 3
		} else {
        	System.println("info phoneConnected");
			return info.phoneConnected; //CIQ versions 1 & 2
		}
	}

When run on the device, the above code prints the following into the log.

fctns fctn isconnavailable
info connectionAvailable status: false
info connectionAvailable

Which mean the FW is reporting that the device has connectionAvailable.  The issue is according to the SDK info the Edge Explorer 1000 and my own usage logs, the Edge Explorer 1000 is running CIQ 2.4.6, and connectionAvailable is a SDK 3.0 feature.  I have sent the user another test build to see what is being reported for both info.phoneConnected and info.connectionAvailable.  I suspect that connectionAvailable is always false, but phoneConnected is properly reporting the status.

In the simulator I get  the following when running the same code.

fctns fctn isconnavailable
info phoneConnected status: true
info phoneConnected

To reproduce use the above function in an app and build it for an Edge 1000/Explorer and run on a Edge Explorer 1000 with the latest firmware.

  • I rolled out a new build with the above code.  The user who reported the problem has reported back that all is working again.  So thank you for the help.  At least I know I have a solution in place that works regardless of what happens with the device FW.

  • Travis,  I really like your solution.  It defaults to using the what I would call better proven option for detecting the phone connection state, but still allow to use the WiFi solution on something like the Edge 830 when the phone is not connected.  Best of all it manages to accomplish all the same features in fewer lines of code than I was looking at.  Many thanks.

  • Yes. The edge1000 has the deviceSettings.connectionAvailable field (which you wouldn't expect given the documentation), but it is set properly. The edgeexplore has the field, and it is always set to false.

    The safest option is to do similar to what you've suggested above, but you will probably still want to use the has check in case your app is used on a device that doesn't have 2.4.2 support.

    var deviceSettings = System.getDeviceSettings();
    
    if (deviceSettings.phoneConnected) {
        return true;
    }
    else if (deviceSettings has :connectionAvailable) {
        return deviceSettings.connectionAvailable;
    }
    else {
        return false;
    }

  • I don't have an edge explorer to test with myself, but I did run my full debug build on my edge 1000 and checked with phone connected and disconnected.  The reason I did not see any issues on my Edge 1000 is that both options are providing the same answer at least.

    Running the above code on Edge 1000 with the phone disconnected: 

    fctns fctn isconnavailable
    info phoneConnected status: false
    info connectionAvailable
    info connectionAvailable status: false

    Running the above code on Edge 1000 with the phone connected: 

    fctns fctn isconnavailable
    info phoneConnected status: true
    info connectionAvailable
    info connectionAvailable status: true

    I will post the logs from the edge explorer 1000 once I get them from my user who reported the problem.

  • Since it is set to true I would not see my widget fail on my Edge 1000.  I will load my debug build and will see what the log shows.

    In the mean time I am thinking about adding a check to the has :connectionAvailable logic to check both options.  Something like the following.

    if (info.connectionAvailavle || info.phoneConnected)) {
    return true;
    } else {
    return false;
    }