Search code examples
appconkit

AppConKit: Set a URL based on the currently configured URL


In the AppConKit, you can give your users the option to configure a Servername, port and path in the Settings that this Apps connects to. Can I somehow access these configured settings in the Javascript code? My use-case is that I have a logo image sitting on the server the app is connecting to, and would like to show this logo based on the server url. Any Idea?


Solution

  • Makes sense, but that's not a setting that is easily accessible (yet).

    You can access the settings via the device switch:

    var hostname;
    var port;
    var path;
    if (vMobileController.device().isAndroid()) {
        hostname = vKVS.value("Weptun_Hostname");
        port = vKVS.value("Weptun_Port");
        path = vKVS.value("Weptun_URL_Path");
    } else { 
        hostname = vKVS.value("server_url");
        port = vKVS.value("server_port");
        path = vKVS.value("server_endpoint");
    }
    if (hostname.substring(0,4)!="http") {
        hostname="http://"+hostname;
    }
    var vUrl = hostname+":"+port+"/"+path+"/images/Logo.png";
    

    I talked with the developers tho, and it would make sense to access this via direct Javascript API. I'll see that it's added to the roadmap!