public function get_setting() {
        global $CFG;

        // First check if is not set.
        $result = $this->config_read($this->name);
        if (is_null($result)) {
            return null;
        }

        // For install cli script, $CFG->defaultuserroleid is not set so return 0
        // Or if web services aren't enabled this can't be,
        if (empty($CFG->defaultuserroleid) || empty($CFG->enablewebservices)) {
            return 0;
        }

        require_once($CFG->dirroot . '/webservice/lib.php');
        $webservicemanager = new webservice();
        $mobileservice = $webservicemanager->get_external_service_by_shortname(MOODLE_OFFICIAL_MOBILE_SERVICE);
        if ($mobileservice->enabled and $this->is_protocol_cap_allowed()) {
            return $result;
        } else {
            return 0;
        }
    }