How to set a runtime license

Obtain a runtime license

Once you finish your development and testing with the Development license, you will need to purchase a runtime license for distribution or deployment.

If you haven't purchased a runtime license for your application, you can purchase it via our online store or send your purchase order to sales@dynamsoft.com. If you want to receive a quote, please submit a request via this page.

After purchase, you can find your license information in the customer portal. Please follow the steps below to activate the runtime license:

For Desktop/Embedded Device/Mobile App

1. Activate a runtime license

Please click on the “Activate Now” link to start activating a selected runtime license key.

It brings you to the following page. Just click on the “Activate” button to activate the license key. If you prefer to host the service on your own server, please contact us for the guide.

Now you can see the Status, Quota and Expiration Date of the activated license key.

You can repeat the above steps to activate other license keys.

2. Set a runtime license key in your program

Please refer to the following sample code to set the activated license key(s) in your application via the initLicenseFromServer API and initLicenseFromLicenseContent.

The client machine will need to use the initLicenseFromServer API to connect to Dynamsoft Hosted server or your own server to obtain the license information, and then use the outputLicenseToString API to get the information of the license and store the information, then use initLicenseFromServerContent API to use the SDK offline with the license sent.

The code on how to implement initLicenseFromServer and initLicenseFromLicenseContent APIs will be shown below using C. The way to implement the APIs with other languages is similar, the key is to get the license information and then use the information to use our SDK offline.

C:

    //c
    char info[512];
    if(license file does not exist on the local machine)
    {
    //connect to Dynamsoft server to verify the license. 
    DBR_InitLicenseFromServer(hBarcode, "", "licenseKey1;licenseKey2");

    //if you wish to use SDK offline
    //store the license information as txt format
    FILE *fp = fopen("license.txt", "w+");
    if (fp == 0)
    {
        printf("can't open file\n");
        return 0;
     }
    fwrite(info, sizeof(char) * 512, 1, fp);
   }
    else if(license file exists on the local machine)
    {
       //get the license information
        FILE *fp = fopen("license.txt", "r");
        fscanf(fp, "%s", &info);
        fclose(fp);
        DBR_InitLicenseFromLicenseContent(hBarcode, "licensekey1;licensekey2",info);
    }

C++:

    //c++
    char info[512];
    if(license file does not exist on the local machine)
    {
       reader.InitLicenseFromServer("", "licenseKey1;licenseKey2");

     //if you wish to use SDK offline
     reader.OutputLicenseToString(info,512)
     //save the information as txt or in othe format.
    }
    else
    {
       //get the license information from the local document saved and export to the variable "info"
       reader.InitLicenseFromLicenseContent("licensekey1;licensekey2",info);
    }

C#:

   //.NET
    char info[512];
    if(license file does not exist on the local machine)
    {
       reader.InitLicenseFromServer("", "licenseKey1;licenseKey2");
    //if you wish to use SDK offline
     reader.OutputLicenseToString(info,512)
     //save the information as txt or in othe format.
    }
    else
    {
       //get the license information from the local document saved and export to the variable "info"
       reader.InitLicenseFromLicenseContent("licensekey1;licensekey2",info);
    }

Java:

    //java
    char info[512];
    if(license file does not exist on the local machine)
    {
       reader.initLicenseFromServer("", "licenseKey1;licenseKey2");
    //if you wish to use SDK offline
     reader.OutputLicenseToString(info,512)
     //save the information as txt or in othe format.
    }
    else
    {
       //get the license information from the local document saved and export to the variable "info"
       reader.InitLicenseFromLicenseContent("licensekey1;licensekey2",info);
    }

iOS:

    self.barcodeReader = [[DynamsoftBarcodeReader alloc] initWithLicenseFromServer:@"" licenseKey:@"licenseKey1;licenseKey2" error:nil];

Android:

    reader.initLicenseFromServer("", "licenseKey1;licenseKey2");

Note:

  • The first parameter is the string of the license server. Leaving it empty ("") means it will connect to Dynamsoft License Server for online verification.

  • If you need to use multiple runtime license keys to support different barcode formats (e.g., 1D and QR) in the same application, please separate the license keys by a semicolon (;).

  • The license verification process on the end user device can be a one-time process. Once a device is registered, the registration file for this specific device can be automatically returned and stored in the device. After that, the registered device is allowed to scan barcodes without a network connection, until the expiration date of the runtime license key. Once the license is expired, the returned results of barcode will include "*".

  • Please don't use the runtime license for the development. If you continue your development/testing work on your development or test machine with the runtime license, your dev or test machine will be counted as a consumed device and registered on the server.

  • If you need to increase the quota of your existing runtime license key, please contact sales@dynamsoft.com.

  1. Remove the free trial license

30-day free trial

When you test with our 30-day free trial SDK, a trial license key is set in the program via the following APIs:

C:

    DBR_InitLicense(hBarcode, "t0068NQAAAI8+mMcYRNwmijAzExhq******");

C++:

    CBarcodeReader reader;
    reader.InitLicense("t0068NQAAAI8+mMcYRNwmijAzExhq******");

C#:

    BarcodeReader reader = new BarcodeReader();
    reader.LicenseKeys = "t0068NQAAAI8+mMcYRNwmijAzExhq******";

VB.NET

    Dim reader As BarcodeReader = New Dynamsoft.Barcode.BarcodeReader()
    reader.LicenseKeys = "t0068NQAAAI8+mMcYRNwmijAzExhq******"

iOS:

    BarcodeReader *br;
    br = [[BarcodeReader alloc] initWithLicense:@"t0068NQAAAI8+mMcYRNwmijAzExhq******"];

Android:

    BarcodeReader mBarcodeReader;
    mBarcodeReader = new BarcodeReader();
    mBarcodeReader.initLicense("t0068NQAAAI8+mMcYRNwmijAzExhq******");

Now that you’ve already purchase a full version license, please comment out the code after you get the runtime license set correctly.

Note:

  • No other code change nor re-installation is required to upgrade from the free trial version to the purchased version.

For Web-Based/JavaScript Edition App

If you finished the development and testing using the development license, and wish to make your application available to your clients, you will need to comment out InitLicenseFromServer and use InitLicense instead. Below is the code snippet for reference:

C:

    // DBR_InitLicenseFromServer(hBarcode, "", "DevelopmentLicenseKey");
    DBR_InitLicense(hBarcode, "f0068NQAAAI8+mMcYRNwmijAzExhq******");

C++:

    CBarcodeReader reader;
    // reader.InitLicenseFromServer("", "DevelopmentLicenseKey");
    reader.InitLicense("f0068NQAAAI8+mMcYRNwmijAzExhq******");

C#:

 // C#
    BarcodeReader reader = new BarcodeReader();
    // reader.InitLicenseFromServer("", "DevelopmentLicenseKey");
    reader.LicenseKeys = "f0068NQAAAI8+mMcYRNwmijAzExhq******;f0068NQAAAIeI8yyQAGUkz******";

VB.NET:

    Dim reader As BarcodeReader = New Dynamsoft.Barcode.BarcodeReader()
    ' reader.InitLicenseFromServer("", "DevelopmentLicenseKey");
    reader.LicenseKeys = "f0068NQAAAI8+mMcYRNwmijAzExhq******;f0068NQAAAIeI8yyQAGUkz******"

PHP:

    // PHP
    $br = new BarcodeReader();
    // $br->initLicenseFromServer("", "DevelopmentLicenseKey");
    $br->initLicense("f0068NQAAAI8+mMcYRNwmijAzExhq******;f0068NQAAAIeI8yyQAGUkz******");

Java:

    BarcodeReader mBarcodeReader = new BarcodeReader();
    // mBarcodeReader.initLicenseFromServer("", "DevelopmentLicenseKey");
    mBarcodeReader.initLicense("f0068NQAAAI8+mMcYRNwmijAzExhq******;f0068NQAAAIeI8yyQAGUkz******");

JavaScript Edition SDK:

    // In the dynamsoft.barcodereader.js file, just replace the trial license with a full license.
    dynamsoft.dbrEnv.productKey= "f0068NQAAAI8+mMcYRNwmijAzExhq******;f0068NQAAAIeI8yyQAGUkz******";

results matching ""

    No results matching ""