Idea
The way software licensing can be added to an application for a mobile OS such as Android or iOS depends on what framework your application is written in. There are multiple possibilities:- Default for that platform: the application is written in the default language for that platform i.e. Java for Android and Objective-C for iOS.
- Bridge: the original application/library is written in C/C++ (eg. producing a .so file) with a wrapper in the default language for that platform (eg. Java for Android).
- Other framework: the application is written in a framework such as Unity or Xamarin.
Implementation
Default language
Android
Since Java is the default language of Android applications, you can use our Java client. You need to use the jar file calledcryptolens-android.jar
. Pre-compiled jar files can be found here.
Please note thatAdding the library You can add the library by addingHelpers.GetMachineCode()
is not supported and that when you callHelpers.IsOnRightMachine()
, you need to use those that allow you to specify a custom machine code. You can use InstanceId instead or other approaches described later in the tutorial.
api files('libs/cryptolens-android.jar')
in build.gradle
(Module: app), as shown below. Please note that cryptolens-android.jar
needs to be in the libs
folder of your project.
run
method below:
iOS
There is no client library for Objective-C or Swift at the moment. Instead, we recommend to use the other approaches listed below.Bridge
A common way to develop mobile applications or SDKs is to put most of the logic into a C++ library and add a wrapper around it in Java or Objective-C. This approach makes it easier to maintain the application (since you mostly have one code base) and it tends to be harder to reverse engineer (since C++ compiles into native CPU instructions). If you develop an SDK, having a bridge allows you to expose functionality without revealing the source code.Other framework
Unity
If your application uses Unity, we recommend the following article for more information.Xamarin
For Xamarin applications, the same approach that was described in the Unity article can be used.Considerations
Machine codes
On mobile platforms,GetMachineCode
and IsOnRightMachine
will not work. Instead, you can use the the identifiers provided by respective platform.