Before you can begin working with AirSig Web API on Android, you will need to download the AirSig Web API Android SDK and ensure that you have a license key.

Getting AirSig Web API Android SDK

The AirSig Web API Android SDK is distributed as a zip file containing a .jar library and a GUI project consists of UI components and sample codes. After downloading the SDK, you will need to obtain a license key before using the API in your application.

version 1.0.0 download URL

The AirSig Web API License Key

Using an API license key enables you to monitor API usage, and ensures that AirSig can contact you about your application if necessary. The usage limitation of the license depending on the service package of your account. The license key is coupled with the application’s package name. Please register AirSig developer account first and then you can obtain a AirSig Web API license key by sending an email to webapi@airsig.com with your application’s package name.

Add the AirSig Web API Android SDK to your project

The AirSig Web API SDK for Android is packaged as a static library. Before using the API, you will need to add a library and a UI module to your project. These instructions assume an installation for a new project.

Using Android Studio

  • Open File -> Project Structure
  • Import Modules from the downloaded package
    • airsigapi_vx.x.x (connect with the Web API)
    • AirSigGui (UI module and sample codes)
  • Add dependencies to the modules just imported
  • Initialize the Engine class, giving your license key and the userID
  • mASEngine = new ASEngine(getApplicationContext(), LICENSE);
    mASEngine.identify(USER_ID);
    					
  • Initialize the UI handler, giving your license key and the userID
  • mASGui = new ASGui(getApplicationContext(), LICENSE, USER_ID);
    					

Using Eclipse with ADT

  • Import project AirSigGui into your workspace
  • Add library airsigapi_vx.x.x
  • In your project’s project.properties add
  • manifestmerger.enabled = true;
    					
  • Initialize the Engine class, giving your license key and the userID
  • mASEngine = new ASEngine(getApplicationContext(), LICENSE);
    mASEngine.identify(USER_ID);
    					
  • Initialize the UI handler, giving your license key and the userID
  • mASGui = new ASGui(getApplicationContext(), LICENSE, USER_ID);
    					

Run the sample code

There are sample codes included in project AirSigGui in the .zip file. To run the sample project, you need the license key too. The license key should be attached in the email we send to you. If it isn’t, please send an email to webapi@airsig.com. You can get more idea about how to use AirSig Web API Android SDK from the samples.

Before the signature can be identified, the user need to set their signatures with several samples. You can choose one of the following methods to do it.

The signature is represented by a ASAction object. actionIndex is the primary key. action is a string you can use to store the action you want to do after the signature is matched. strength represents how secure the signature is. numberOfSignatureStillNeedBeforeVerify indicates how many sample signatures the user still need to complete the training.

Use AirSig designed UI

This is the recommend way to train a signature. AirSig had implemented a friendly user interface for your users to input their signature samples.

// initial UI handler 
mASGui = new ASGui(getApplicationContext(), LICENSE, USER_ID);

// show training UI
mASGui.showTrainingActiviy(ACTION_INDEX); 
				

Modify AirSig designed UI

The UI code is open sourced, you can modify it on your own. Please check TrainingActivity and VerifyActivity for more details.

Build your own UI

In class ASEngine in the package com.airsig.webclient, we provide methods to be called to train a signature. You can develop your own UI which follow the call sequence:

// Start recording motion sensor data. You can use a button to let user trigger to start record signature, or other trigger mechanisms.
mASEngine.startRecordSensor();

// Complete the sensor recording of a signature, and send to server to train a signature. You can know if the signature is well trained or not from the result listener onCompleteRecordSensorToTrainActionResult . It takes several times to train a signature. 
mASEngine.completeRecordSensorToTrainAction(ACTION_INDEX); 
				

In this stage, user inputs a signature, the AirSig system will return the matched signature which represented as an ASAction object. If there is no trained signature in the user account, the system will return the message of no match. Calling the following methods will present an UI for user to identify his/her signature.

// get the finger position you want user to identify
mASEngine.getAction(ACTION_INDEX);

// get the finger position you want user to identify
mASEngine.getAction(ACTION_INDEX);

// in result listener
mFingerPositionX = (float) action.fingerPointX;
mFingerPositionY = (float) action.fingerPointY;

// show the identify view
mASGui.showIdentifyActivity(ACTION_INDEX, mFingerPositionX, mFingerPositionY);
				

Strength setting

By default, after the user set their signatures by several sample signatures, the AirSig system will obtain a strength level of the signature. If the sample signatures are more consistent, the strength is much stronger. Which means that in identify stage, the input signature must be more similar with the training samples to pass the authentication.

You can change the strength level depending on your application. If your application is security sensitive, then you should not change the strength level. If your application is not security sensitive, you can change the strength level weaker to make your users easier to pass. Here is how to do it.

// After the signature is well trained.
// Set the strength level you want
action.strength = ASStrengthWeak;

// Update to server
ArrayList<ASAction> actions = new ArrayList<ASAction>();
actions.add(action); 
mASEngine.setActions(actions);
				

Avoid to share signature data between different phone models

When users writing their air signatures via different phone models, there might be slightly different. Since different device size and weight distribution cause users holding the phone differently, their signatures are different too. It’s recommended to let users re-input their sample signatures in different models.

Before you can begin working with AirSig Web API on iOS, you will need to download the AirSig Web API iOS SDK and ensure that you have a license key.

Getting AirSig Web API iOS SDK

The AirSig Web API iOS SDK is distributed as a zip file containing a static framework and sample codes. After downloading the SDK, you will need to obtain a license key before using the API in your application.

version 1.0.0 download URL

The AirSig Web API License Key

Using an API license key enables you to monitor API usage, and ensures that AirSig can contact you about your application if necessary. The usage limitation of the license depends on the service package of your account. The license key is coupled with the application’s bundle identifier. Please register AirSig developer account first and then you can obtain a AirSig Web API license key by sending email to webapi@airsig.com providing your application’s bundle identifier. Once you have the license key, you add it to your AppDelegate as described in the next section.

Add the AirSig Web API iOS SDK to your project

The AirSig Web API SDK for iOS is packaged as a static framework. Before using the API, you will need to add the framework to your project and configure your build settings in Xcode. These instructions assume an installation for a new project.

  • Launch Xcode and either open an existing project, or create a new project.
  • In project target, find embedded binaries section, add ASEngineAPI.framework.
  • Add your license key to your AppDelegate
  • #import <ASEngineAPI/ASEngine.h>
    					
    Add the following to your application:didFinishLaunchingWithOptions: method, replacing LICENSE_KEY with your license key.
    [ASEngine sharedInstanceWithLicense:@”LICENSE_KEY”];
    					
  • (Optional) Set the user ID
    By default, we use [UIDevice identifierForVendor] as user ID. You can change it by calling:
  • [[ASEngine sharedInstance] identify:@”USER_ID”];
    					

Run the sample project

There are sample codes included in a sample project in the .zip file. To run the sample project, you need the license key too. The license key should be attached in the email we send to you. If it isn’t, please send an email to webapi@airsig.com. You can get more idea about how to use AirSig Web API iOS SDK from the samples.

Before the signature can be identified, the user need to set their signatures with multiple samples. You can choose one of the following methods to do it.

The signature is represented by a ASAction object. actionIndex is the primary key. action is a string you can use to store the action you want to do after the signature is matched. strength represents how secure the signature is. numberOfSignatureStillNeedBeforeVerify indicates how many sample signatures the users still need to complete the training.

Use AirSig designed UI

This is the recommend way to train a signature. AirSig had implemented a friendly user interface for your users to input their signature samples.

[[ASEngine sharedInstance] 
presentTrainingViewControllerForAction:ACTION_INDEX 
ParentViewController:self 
Callback:^(ASAction *action, NSError *error) { 
}];
				

Customize your own UI

We also opened some interfaces for you to customize the AirSig provided user interface. Please check ASEngineSetting for more detail. If you have more requirements to customize the user interface, please send your request to webapi@airsig.com, and briefly describe your case. We will schedule the requests based on the urgency.

Fully control by yourself

If you can’t wait for us to implement the user interface you need. You can develop by your own. Following are the steps.

//Before start record signatures for training, call this method to wake up motion sensors to prevent latency in recording signature motion.
[[ASEngine sharedInstance] warmupSensor];

// Start recording motion sensor data. You can use a button to let user trigger to start record signature, or other trigger mechanisms.
[[ASEngine sharedInstance] startRecordSeneor];

// Complete the sensor recording of a signature, and send to server to train a signature. You can know if the signature is well trained or not from the callback. It takes several times to train a signature.
[[ASEngine sharedInstance] 
completeRecordSeneorToTrainAction:ACTION_INDEX
Callback:^(ASAction *action, NSError *error) {
}];

// After the signature is well trained. Call this method to stop motion sensor
[[ASEngine sharedInstance] cooldownSensor];
				

In this stage, when user inputs a signature, the AirSig system will return the matched signature which represented as an ASAction object. If there is no trained signature in the user account, the system will return the message no match.

Present the UI to let user identify his signature

Calling the following method will present an UI for user to identify his signature. The returned ASIdentifyView can let you to set up some customization features. Please check the class file for more detail.

[[ASEngine sharedInstance] presentIdentifyViewDelegate: self];
							

Get the result

You can get the result from the delegate ASIdentifyViewDelegate input to the method above. IdentifyViewWillDismiss:Result: will be called when the view is going to dismiss, attached the last matched signature in this session. IdentifyViewWillIdentifyingSignature: will be called when user just input a signature. IdentifyViewDidIdentifyingSignature:Result:Error: will be called after verifying the user input signature, attached a ASAction object if the matched signature is found.

Fallback solution

You can implement a fallback solution if the user can’t pass their own signature, i.e. the false negative is too high in some special cases. Implement IdentifyViewDidIdentifyingSignature:Result:Error: method in ASIdentifyViewDelegate to do it. Here is a sample use touch ID as a fallback solution:

- (void)IdentifyViewDidIdentifyingSignature:(ASIdentifyView*)sender Result:(ASAction*)action Error:(NSError*)error { 
    if (!action) { // no match
        // check Touch ID already set
        LAContext *context = [[LAContext alloc] init]; 
        NSError *error = nil; 
        if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) { 
            [context 
            	evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics 
                localizedReason:@"" 
                reply:^(BOOL success, NSError *error) { 
                    if (success) { // passed
                        [ASIdentifyView dismiss]; 
                    } 
            }]; 
        } 
    } 
}
				

Handle sensor initialization delay

There might be a short delay between the time that the trigger start motion sensor and the motion sensor really start working. This delay makes some signature data being missing. It depends on device and OS. We have implementation to solve this issue.

// Start motion sensor before about going to trigger to record signature
[[ASEngine sharedInstance] warmupSensor];

// Do things here

// After all done. Stop the motion sensor.
[[ASEngine sharedInstance] cooldownSensor];
				

If you use AirSig designed UI, you don’t have to worry about this issue.

Strength setting

By default, after the users set their signatures with several sample signatures, the AirSig system will obtain a strength level of the signature. If the sample signatures are more consistent, the strength is stronger. Which means in identify stage, the input signature must be more similar with the training samples to pass.

You can change the strength level depending on your application. If your application is security sensitive, then you should not change the strength level. If your application is not security sensitive, you can change the strength level weaker to make your users easier to pass the authentication. Here is how to do it.

// After the signature is well trained.

// Set the strength level you want
action.strength = ASStrengthWeak;

// Update to server
[[ASEngine sharedInstance] 
setAction:action 
Callback:^(ASAction *action, NSError *error) { 
}];
				

Avoid to share signature data between different phone models

When users writing their air signatures via different phone models, there might be slightly different. Since different device size and weight distribution cause users holding the phone differently, their signatures between different device models are different too. It’s recommended to let users re-input their sample signatures in different models.