Finding the Remaining Days/Hours of a Trial License

Declare Variables/Constants

String FEATURE_NAME = "FeatureTrial";
String FEATURE_VERSION = "1.0";
String CONTACT_SERVER = "localhost";

String ScopeFeatureInfo=new String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
                                      "<feature index=\"0\">"+
Attribute attrAppContext = null;
ApplicationContext appContext = null;

API Calls

To check the remaining days/hours for a trial license, execute the APIs in the specified sequential order only:

>attrAppContext = new Attribute();


NOTE   If instead the LSFORCEHOST or LSHOST environment variables are set, then the above-mentioned steps are not required.

>appContext = new ApplicationContext(attrAppContext);

>String featureInfo = appContext.getInfo(ScopeFeatureInfo, LicensingConstants. SNTL_QUERY_FEATURE_INFO_VERSION("1.0"));

If the appContext.getInfo call is successful, the featureInfo string contains an XML-based output having the detailed information.

Parse this XML, the "trialDaysLeft" and the "trialSecondsLeft" tags in this XML contains the remaining number of trial days and trial hours (in seconds), respectively.

NOTE   The trial usage information is refreshed while requesting, updating, or releasing a trial license.