How to Integrate Sentinel Licensing API in Your Application

This section is relevant if you want to use the integrated protection method for your application.

To integrate Sentinel Licensing API in your application

1.Build the JNI layer as follows:

a.Ensure that NDK is installed on your machine (for example: C:\android-ndk-r9).

b.Modify Java/jni/Android.mk to link your vendor-specific library (libhasp_android_<vendorId>.a).

c.Switch to the Java directory. Run C:\android-ndk-r9\ndk-build from a command prompt.

d.The JNI library is generated in Java/libs/armeabi-v7a/libHASPJava.so and in Java/libs/arm64-v8a/libHASPJava.so.

2.Add the following files to your project:

Java/src/com/Aladdin/Hasp.java

Java/src/com/Aladdin/HaspApiVersion.java

Java/src/com/Aladdin/HaspStatus.java

Java/src/com/Aladdin/HaspTime.java

Java/src/com/Aladdin/HaspUsbHandler.java

Java/libs/armeabi-v7a/libHASPJava.so

Java/libs/armeabi-v7a/libhasp_android_<vendorId>.so (see step 1 above)

Java/libs/arm64-v8a/libHASPJava.so

Java/libs/arm64-v8a/libhasp_android_<vendorId>.so (see step 1 above)

3.Refer to Java/src/com/HaspDemo/HaspDemo.java to see how to call the Licensing API.

4.Add the following line to load the LDK JNI library:

System.loadLibrary("HASPJava");

5.If you are using Sentinel HL keys to protect and license your application:

Call the getPermission method of class HaspUsbHandler to get the permission to access the Sentinel HL key in your application.

6.Add the following lines to AndroidManifest.xml for your project:

<uses-sdk android:minSdkVersion="14" />

7.If you are using Sentinel HL keys to protect and license your application, add the following line to AndroidManifest.xml for your project:

<uses-feature android:name="android.hardware.usb.host" />