Problem with checkWifiConnection()

I am making a little application that uses the Communications module, specifically the checkWifiConnection method. I followed the implementation as stated in the API docs. However, I am getting an Invalid value error.

The error I am getting is 
Error: Invalid Value Details: Failed invoking <symbol> in line 22

Note: the code is unfinished so don't worry about the rest.

using Toybox.Communications as Comm;
using Toybox.System as Sys;
using Toybox.Position as Position;

class GeofenceHelper {


    function initialize() {
        checkWifiConnection();
    }

    private function getStatus(){
        
    }

    private function getError(){

    }

    // Wi-Fi connection checking
    private function checkWifiConnection() {
        Comm.checkWifiConnection(method(:onWifiConnectionChecked));
    }

    // Callback method for checkWifiConnection
    private function onWifiConnectionChecked(result) {
        var wifiStatus = result[:wifiAvailable];
        var errorCode = result[:errorCode];
    }
}

  • I've not used that API.  What I've used instead is

    System.getDeviceSettings().connectionInfo

    (see the bulkDownload sample in the SDK, BulkDownloadBehaviorDelegate.mc for an example)

    In general, wifi isn't enabled on a watch (edge devices are a bit different) the majority of the time.  Pretty much when you are downloading new firmware or something like music.  On watches, it's just used for bulk download/media sync.  You can see this in the sim, under settings>Connection Type

    Also remember, not all watches even have wifi

    Are you testing in the sim or on a real device?  The error you see could be specific to one or the other.