The method for initializing the Wepin Android PIN Pad Library is as follows.
Copy import com.wepin.android.pinlib.WepinPin
Before creating an instance of WepinPin
, please pass the app’s Activity Context, the app ID, and the app key assigned after app registration to the WepinPinParams
object as shown below.
Copy val wepinPinParams = WepinPinParams(
context = this,
appId = "your-wepin-app-id",
appKey = "your-wepin-app-key"
)
Please create a WepinPin
instance by passing the previously created WepinPinParams
.
Copy val wepinPin = WepinPin(wepinPinParams)
After creating the WepinPin
instance, call the initialize
method to complete the initialization.
Copy val res = wepinPin.initialize(attributes)
parameters
atrributes
<WepinPinAttributes>
defualtLanguage
<String>
The default language setting for the PIN pad screen is 'en'
. Currently supported languages are 'ko'
, 'en'
, and 'ja'
.
Return value
CompletableFuture
<Boolean>
Returns true if successful, and false if it fails.
Example
Java Kotlin
Copy public class MainActivity extends ComponentActivity {
private WepinLogin wepinLogin;
private WepinPin wepinPin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example_main);
initView();
// Initialize Wepin Login Library
// ...
// Initialize Wepin PIN Pad Library
WepinPinParams wepinPinParams = new WepinPinParams(
this,
"your-wepin-app-id",
"your-wepin-app-key"
);
wepinPin = new WepinPin(wepinPinParams);
WepinPinAttributes attributes = new WepinPinAttributes("en");
CompletableFuture<InfResponse> res = wepinPin.initialize(attributes);
if (res != null) {
res.whenComplete((infResponse, error) -> {
if (error == null) {
System.out.println(infResponse);
} else {
System.out.println(error);
}
});
}
// ...
}
}
Copy class MainActivity : ComponentActivity() {
private lateinit var wepinLogin: WepinLogin
private lateinit var wepinPin: WepinPin
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_example_main)
initView()
// Initialize Wepin Login Libary
// ...
// Initialize Wepin PIN Pad Libary
val wepinPinParams = WepinPinParams(
context = this,
appId = 'your-wepin-app-id',
appKey = 'your-wepin-app-key'
)
wepinPin = WepinPin(wepinPinParams)
var attributes = WepinPinAttributes("en")
val res = wepinPin.initialize(attributes)
res?.whenComplete { infResponse, error ->
if (error == null) {
println(infResponse)
} else {
println(error)
}
}
// ...
}
isInitialized
You can use the isInitialized
method to check if the WepinPin
instance has been successfully initialized.
The return values are as follows
<Boolean>
Returns true if initialization was successful and false if it failed.
Example
Java Kotlin
Copy if(wepinPin.isInitialized()){
// Success to initialize WepinPin
}
Copy if(wepinPin.isInitialized()){
// Success to initialize WepinPin
}
changeLanguage
Copy wepinPin.changeLanguage("ko")
Changes the language displayed on the PIN pad screen. Currently, only 'ko'
, 'en'
, and 'ja'
are supported.
Parameters
Return value
CompletableFuture
<Boolean>
Returns true if successful and false if it fails.
Example
Java Kotlin
Copy wepinPin.changeLanguage("ko").whenComplete((res, err) -> {
if (err == null) {
System.out.println(res);
} else {
System.out.println(err);
}
});
Copy wepinPin.changeLanguage("ko").whenComplete{ res, err ->
if (err == null) {
println(res)
} else {
println(err)
}
}
Last updated 3 months ago