Installing Kevlar

Enabling Activation and Trial functionality requires integration of the specific Kevlar library. This library is unique for each application in DevMate and, therefore can be used only for one particular app. It ensures secure communication between your app and DevMate as well as manages license information on the app's side.

  1. Take the steps described in Integrate DevMateKit if you haven't done it yet.

📘

NOTE

The latest version of DevMateKit is available here.

  1. Download a Kevlar library from the corresponding page of DevMate's Add Application wizard. Alternatively, choose your app from the list of applications and go to Settings > DevMateKit. Disclose 'Activations and Trial' block and click Download Kevlar Library.
  2. Extract files from the downloaded archive and drop them to your project. Apply the following settings in the dialogue that appears:
  • Select the 'Copy items if needed' checkbox
  • Choose the 'Create groups' option
  • Deselect all items in the 'Add to targets' list.
  1. Link the Kevlar library to your project. Go to the Build Settings tab and add the following string to Other Linker Flags:
  • If the Kevlar folder is located in the project root folder:
-ObjC "$(PROJECT_DIR)/Kevlar/libkevlar.a" -lc++ -framework Security -framework IOKit
  • If the Kevlar folder is located in other location:
-ObjC <path_to_Kevlar_lib> -lc++ -framework Security -framework IOKit

Enable Activations

  1. Add the following code to the import section of your application Objective-C delegate class file or to the special bridging header of your Swift target:
#import "DMKevlarApplication.h"

📘

NOTE

Before importing the DevMateKit framework, please make sure that the DMKevlarApplication.h header file is included. Otherwise, you will receive a warning console message (WARNING: Need Kevlar library for correct work).

  1. Add the following method to your application delegate class implementation:
- (IBAction)startActivationProcess:(id)sender {
    if (!DMKIsApplicationActivated(NULL)) {
        [DevMateKit runActivationDialog:nil inMode:DMActivationModeFloating];
    }
}
@IBAction func startActivationProcess(sender: AnyObject?) {
    // Swift does’t work with macros, so check our Examples project on GitHub (https://github.com/DevMate/DevMateKit)
    //     to see how to create _my_secret_activation_check variable
    var kevlarError = DMKevlarError.testError
    if (false == _my_secret_activation_check!(&kevlarError).boolValue || kevlarError != DMKevlarError.noError) {
        DevMateKit.runActivationDialog(nil, in: DMActivationMode.modal)
    }
}
  1. Connect the newly added action method with the corresponding menu item or button inside the XIB files.

See GitHub example for more information.

Enable Trial

  1. Add the following code to the applicationDidFinishLaunching method of your application delegate class to initialize time trial. This example is for a one-week trial period:
if (!DMKIsApplicationActivated(NULL)) {
		[DevMateKit setupTimeTrial:nil withTimeInterval:kDMTrialWeek];
}
// Swift does’t work with macros, so check our Examples project on GitHub (https://github.com/DevMate/DevMateKit)
//     to see how to create _my_secret_activation_check variable
if !_my_secret_activation_check!(nil).boolValue {
    DevMateKit.setupTimeTrial(nil, withTimeInterval: kDMTrialWeek)
}
  1. Build and run your application.

See our GitHub example for more information.

📘

NOTE

While we do our best to keep DevMate frameworks secure and reliable, you should protect your software carefully against cracking attempts as well.

For your convenience, we prepared a few tips that will help you protect your app.

Functionality-Based Trial

You can set a trial period that ends after a predefined number of applications is launched or when a certain action is taken (for example, a click on a button). See our GitHub example for more information.

Customize User Interfaces

There are several methods of customizing activation windows:

  • Instead of +[DMActivationController sharedController] or +[DMActivationController defaultController] methods initialize controller with -[DMActivationController initWithWindowNibName:] passing your .nib file name here.
  • Create your own subclasses of the DMStepController class (with its XIB) and register/re-register them using the -registeredStepController:withNibName:forActivationStep: method.
  • Use DMActivationController delegate methods to change controller behavior.

Setting Up Activation by URL Scheme

Activation by the URL scheme enables activation directly from an email or web page. To configure activation by URL scheme, add the following code snippet to the info.plist file of your application:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>com.devmate.ActivationScheme</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>schemename1</string>
            ... // other scheme names that also will be uses for activation
        </array>
	</dict>
    .... // other URL schemes used for other purposes
</array>

CFBundleURLTypes is a special key, which contains NSArray of NSDictionaries. One of them is used for registration of activation schemes. It contains a CFBundleURLName special key with the value set to com.devmate.ActivationScheme.

<string>schemename1</string> is the declaration of the scheme (replace schemname1 with a name of a URL scheme to be used).

📘

NOTE

You can view an example on GitHub.

Paddle Checkout

Paddle's checkout simplifies software purchases by integrating a checkout page directly into the application.

Deactivate License

If you want to add an ability to deactivate a license from UI of your app, connect -[NSApplication invalidateLicense] to the corresponding button or menu item.