How do I integrate Advanced Analytics SDK in my C# application?

RequirementsCopy link to this sectionLink to this section copied!

To integrate Advanced Analytics in a C# application you can follow this article which explains Program.cs from the C# sample on GitHub.

TipWe encourage you to use this sample as a starting point so you can understand how the SDK works, then to expand the logic and use your own methods according to your application's architecture.

The exported functions that leverage the SDK functionality are:

  • AA_Start(appID, appVersion) - Initializes the service using the appID and appVersion parameters. This method must be called before any other calls to the SDK.
  • AA_Stop() - After this function is called, any further calls to the SDK will not work.
  • AA_Enable(true|false) - Enables/disables data sending to the server.
  • AA_IsEnabled() - Returns true/false depending on whether data sending is enabled/disabled.

Step 1 - Instantiate an object based on the class that loads the native SDK library.Copy link to this sectionLink to this section copied!

You can get this class from the linked sample, it is called AdvancedAnalytics and declared within the Caphyon namespace from AdvancedAnalyticsC#Bridge.cs.

This class loads the native DLL which contains the data sending logic and calls the proper methods based on the process type (x86 or x64) via dynamic linking.

Caphyon.AdvancedAnalytics lAdvancedAnalytics = new Caphyon.AdvancedAnalytics();

Step 2 - Get the app id from your Advanced Installer project or from your Installer Analytics account.Copy link to this sectionLink to this section copied!

App id

Step 3 - Set a couple variables to the app id and version.Copy link to this sectionLink to this section copied!

They will be passed as parameters to initialize the service.

String appId = "012345678901234567890123";
String appVersion = "1.0.0";

Step 4 - Initialize the service by calling Start which is linked to AA_Start from the SDK.Copy link to this sectionLink to this section copied!

lAdvancedAnalytics.Start(appId, appVersion);

Step 6 - Run the application.Copy link to this sectionLink to this section copied!

RunApp();

Step 7 - When the app needs to close, stop the tracking service by calling Stop which is linked to AA_Stop from the SDK.Copy link to this sectionLink to this section copied!

lAdvancedAnalytics.Stop();