Licensing/Initialization¶
In order to use the SDK a license must be acquired first.
Each license is associated with an AppID and available features. So it can be used ONLY from the application with this AppID and only the available features will be enabled.
Supported features¶
- BLE: device data retrieval via Bluetooth LE
- NFC: device engagement and data retrieval via NFC technology (comming soon)
- WiFi-Aware: device data retrieval over WiFi (comming soon)
- WebAPI: server data retrieval using web API
Initialize SDK with license¶
SDK provides two ways to initialize using the acquired license.
- Using a license file: In this case you have been provided a license file. This method does not require Internet connectivity.
- Using a license key: Instead of a license file, you have a license key that it is used to activate your license. This method requires Internet connectivity
Importing license file in Application¶
Place the liscense file (e.g. license.skm
) in the application's raw resources directory. Then use
the VerifierSDK#initWithLicense(Context, int)
method to initialize the SDK.
Example
package com.example.app;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import com.scytales.mvalid.sdk.VerifierSDK;
import com.scytales.mvalid.sdk.VerifierSDKStatus;
public class LauncherActivity extends AppCompatActivity {
private static final String TAG = "LauncherActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launcher);
VerifierSDKStatus status = VerifierSDK.initWithLicense(
getApplicationContext(), R.raw.license);
if (status != VerifierSDKStatus.INITIALIZED) {
// handle initialization failure
Log.e(TAG, status.getMessage());
} else {
// navigate to MainActivity
Intent intent =
new Intent(this, MainActivity.class);
startActivity(intent);
}
}
}
Using License Key¶
If you are provided with a license key instead of a license file, use
the VerifierSDK#initWihtLicenseKey(Context, String, InitSDKCallback)
method.
This method requires Internet connection to be able to initialize the SDK.
Example
package com.example.app;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.scytales.mvalid.sdk.InitSDKCallback;
import com.scytales.mvalid.sdk.VerifierSDK;
import com.scytales.mvalid.sdk.VerifierSDKStatus;
public class LauncherActivity extends AppCompatActivity implements InitSDKCallback {
private static final String TAG = "LauncherActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launcher);
String licenseKey = "XXXXX-XXXXX-XXXXX-XXXX";
VerifierSDK.initWithLicenseKey(
getApplicationContext(), licenseKey, this);
}
@Override
public void onInitSDK(@NonNull VerifierSDKStatus verifierSDKStatus) {
if (verifierSDKStatus != VerifierSDKStatus.INITIALIZED) {
// handle initialization failure
Log.e(TAG, verifierSDKStatus.getMessage());
} else {
// navigate to MainActivity
Intent intent =
new Intent(this, MainActivity.class);
startActivity(intent);
}
}
}
License acquisition¶
Contact us to request a pricing quote. You will have to provide your AppID/BundleID in order to acquire a license and which of the following features you want to enable.