ajvpr
Posts: 15
Joined: Fri Apr 01, 2016 2:09 am

Licensing Library Properties not available on Trial

I want to be able to figure out in my application how many days are left in my trial license so I can display some alerts. I can get all the available properties on a regular valid license but I don't seem to get any relevant values when I'm in a Trial License.

I'm looking at the "TrialLeft" property in specific.

Is this a limitation of the Licenser module or am I doing something wrong?

Thanks
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Licensing Library Properties not available on Trial

Hello and welcome to Advanced Installer forums,

I've tested your scenario and it worked as expected.

I've successfully read the value of the TrialLeft property.

Can you please tell us how you read this property? Can you give us a test case scenario?

By the way, what application do you have? Is it developed in C#? For C# application, you should have something like that:

Code: Select all

// Get TrialLeft property
        StringBuilder trialLeft = new StringBuilder();
        UInt32 len = (UInt32) trialLeft.Capacity;
        if ( GetPropertyValue("TrialLeft", trialLeft, ref len) == 234 )
        {
          trialLeft.EnsureCapacity((Int32)len);
          GetPropertyValue("TrialLeft", trialLeft, ref len);
        }
		  TrialLeftBox.Text = trialLeft.ToString();
        Debug.WriteLine("TrialLeft=" + trialLeft);
When the app is started, the trial period is properly displayed:
TrialSample.png
TrialSample.png (23.93 KiB) Viewed 3439 times
Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ajvpr
Posts: 15
Joined: Fri Apr 01, 2016 2:09 am

Re: Licensing Library Properties not available on Trial

It's a java application. Here are the steps I'm taking to get to the point where I display some of the properties:

1. Load the licenser DLL

Code: Select all

trialLib = (TrialLibrary) Native.loadLibrary("TrialLib", TrialLibrary.class);
2. Call ReadKey

Code: Select all

 trialLib.ReadSettingsRetStr(libraryKey, null);
3. Go on to the main application and display properties

Code: Select all

AdvancedLicenseLibrary.instance.GetPropertyValue("TrialLeft");
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Licensing Library Properties not available on Trial

Hello,

We apologize for our delayed reply, but we were a bit busy lately.

When using our Licensing feature (trial.dll) for a java application (defined as a java product in our "Java Products" page) you don't need to dynamically load our trial.dll within your java application code.

We have enhanced trial support for Java Products and all you have to do to call the "GetPropertyValue" function of our trial.dll is to:

1. declare the "GetPropertyValue(String aName)" native method in your main class exactly like this:

Code: Select all

public native static String GetPropertyValue(String aName) throws Exception;
2. and then call the "GetPropertyValue(String aName)" method from your java application code like this:

Code: Select all

try {
    String value = GetPropertyValue("TrialName");
    ...
} catch (Exception e) {
    e.printStackTrace();
}
For your future reference you can take a look on our "Integrate Licensing support in Java applications" and "Retrieve Licensing Elements" user guide articles.

If there is anything we can assist you with just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”