Get the Android SDK
First, you should add the Safous WAAP Android SDK to your project. Visit WAAP Admin Portal to get the latest version of our SDK.
Adding the SDK to Your Project
After obtaining the SDK, insert it into your project's app/libs
directory (<project>/app/libs
) in your Android project.
Embedding the SDK in the Gradle Module
Now, open your build.gradle
file (<project>/build.gradle
) in Android Studio. Then, in the root-level Gradle file, include the SDK files that you have obtained as dependencies. The syntax is provided below:
implementation files('libs/SafousWaap.aar')
Pre-requisition
Before you configure the Android SDK, make sure you already have the certificate for authentication to accessing the environment. Below is the steps for set the certificate on your project
- Download the certificate with .p12 format. If you have not generate the Trusted Certificate, you can create it in Safous portal dashboard. More info for how to generate the certificate provided here.
- Put the certificate on your project. Specifically in raw folder in resources directory (<project>/app/src/main/res/raw).
Setup Environment
For this section, we will call function setupEnv in the SDK. Before that, you have to setup the path for certificate in your Activity class. Now start using the Android SDK. First import the ApiProtection java class from SDK and put it on your Activity class.
import com.safous.waap.ApiProtection;
Then you need to initialized new variable in your Activity class. This variable instance to ApiProtection java class. So it can inherit all the values in SDK to be used in your Activity class.
public static ApiProtection protection;
Next you put the ApiProtection variables and declare it on your Activity class.
protection = new ApiProtection(getApplicationContext());*note: getApplicationContext are needed to be Context extension in your Activity Class
Before calling the setup Environment function in SDK, make sure you have all the values that needed for parameters in setup Environment function. All of these values are mandatory to filled. So make you had all of these values.
Configuration Name | Description |
xAppId | Unique identity for client registered by Safous WAAP, example : mobile apps, web apps, etc |
UrlReg | Access URL for registration device to Safous WAAP |
UrlAuth | Access URL for authentication device to Safous WAAP |
UrlVerify | Access URL for client verification to Safous WAAP |
certPath | Certificate path or location |
certPass | Certificate Passphrase |
If you already have all the values for parameters above, finally you can create a Setup Environment function. Use the variables with ApiProtection instance for get the SetupEnv method.
protection.setupEnv(
<xAppId>,
<UrlReg>,
<UrlAuth>,
<UrlVerify>,
<certPath>,
<certPass>;
As summary, your code to setup the environment of SDK should be like this.
import com.safous.waap.ApiProtection;
public class YourActivity extends AppCompatActivity {
...
public static ApiProtection protection;
...
public void yourFunction() {
...
...
protection = new ApiProtection(getApplicationContext());
protection.setupEnv(
<xAppId>,
<UrlReg>,
<UrlAuth>,
<UrlVerify>,
<certPath>,
<certPass>;
}
...
}
After done all the setup environment, Next you can use Registration and Transaction modules on this Android SDK. As a note, you still can calling the functions in Registration and Transaction modules from the Android SDK, however it will not work before you setup the environment first.