Licensing the application

3901
5
Jump to solution
07-08-2015 12:35 PM
PremRadhakrishnan
New Contributor III

I got my runtime licenses and also generated the client id and set it for the application.

Here is my question, the sample shows the code below. What are the 4 parameters in this? my license code that I purchased is the format RUD..........  .

If I put this is Component.onCompleted in main.qml will that be sufficient?

    

var licenseCode = "runtimestandard,101,rux00000,none,XXXXXXX";

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

Prem-

Yes, just copy the whole string into it.

-Luke

View solution in original post

0 Kudos
5 Replies
LucasDanzinger
Esri Frequent Contributor

Hi Prem-

It looks like our doc hasn't been updated correctly. I will put in a request to get this fixed up.

Since you are obtaining a license and not going through portal, you will need to do the following:

- Go into the AppInfo.h and set your client id

- Go into the AppInfo.h and set your license (and uncomment it)

This will eventually call the following lines in the main.cpp

// Initialize license


#ifdef kClientID
    QCoreApplication::instance()->setProperty("ArcGIS.Runtime.clientId", kClientId);
#ifdef kLicense
    QCoreApplication::instance()->setProperty("ArcGIS.Runtime.license", kLicense);
#endif
#endif

If you aren't using our template, then use the above lines and replace kClientId and kLicense with the info you have received.

You actually can't set the license in QML, as this could be a potential security issue, as the QML is interpreted and not necessarily compiled. You can check if everything is set correctly in QML though, by doing something like the following:

Component.onCompleted: {
    if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelBasic) {
        console.log("basic");
    } else if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelStandard) {
        console.log("standard");
    } else if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelDeveloper) {
        console.log("developer");
    }
}

Thanks,

Luke

PremRadhakrishnan
New Contributor III

Thanks Lucas.

What do I actually put in kLicense? Just the RUD... code ?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Prem-

Yes, just copy the whole string into it.

-Luke

0 Kudos
PremRadhakrishnan
New Contributor III

I purchased a license pack and I put the code in but my license level according to console log is "basic". The license that I purchased is standard license though. Any thoughts?

Should it be like this ?

#define kLicense   "RUDNNNNNNNNN" // N is a number

or

#define kLIcense "runtimestandard,101,RUDNNNNNNNNN,none,XXXXXXX";

what are the 4 parts in the string ?

0 Kudos
PremRadhakrishnan
New Contributor III

Was able to get this resolved with help from Lucas and the ESRI team.

Make sure that you get the whole license string from your contact at ESRI and not just a code.

Cheers

Prem