AlphynSDK Class
Main SDK class providing core functionality. All methods are static. Getters throw AlphynException if the SDK is not initialized or the operation fails (getCode() returns codes such as SDK_NOT_INITIALIZED, SCAN_PENDING, INVALID_PARAMETER, OPERATION_FAILED).
Initialization
Section titled “Initialization”initialize(Context context)
- Description: Initializes the SDK keyless - the recommended mode for production. The app’s attestation identity is the SHA-256 of its signing certificate, which is stable across builds signed with the same key.
- Parameters:
context- Application context (required) - Returns:
AlphynSDKinstance (for call chaining) - Throws:
IllegalArgumentExceptionif parameters are null or invalid - Thread:
initialize()returns once setup has finished, so calling it on the main thread delays the app’s first frame. Call it from a background thread, or useinitializeAsync. Listener callbacks are delivered on the main thread.
initializeAsync(Context context, InitializeCallback callback)
- Description: Initializes the SDK keyless, as
initialize(Context)does, on a background thread. The recommended way to initialize fromApplication.onCreate()or any other main-thread code. Available from SDK 1.8.5. - Parameters:
context- Application context (required);callback- receives the outcome (required) - Returns: Immediately, before setup has finished
- Throws:
IllegalArgumentExceptionat the call if a parameter is null - Callback:
onComplete(Throwable error)runs on the main thread once setup has finished.errorisnullon success; otherwise it is the exceptioninitializewould have thrown. The run’sINIT_COMPLETE/INIT_FAILEDlistener events are delivered before it.
AlphynSDK.initializeAsync(this, error -> { if (error != null) { Log.e("Byteria", "Initialization failed: " + error.getMessage()); }});initialize(Context context, String applicationKey)
- Description: Initializes the SDK with a development-only debug hash obtained from the Alphyn Portal (App Details → App Info). Do not use in production - a supplied value overrides the app’s attestation hash.
- Parameters:
context- Application context;applicationKey- debug hash (must not be null or empty) - Returns:
AlphynSDKinstance - Throws:
IllegalArgumentExceptionif parameters are null or invalid
initializeAsync(Context context, String applicationKey, InitializeCallback callback)
- Description:
initializeAsyncwith the development-only debug hash, asinitialize(Context, String)takes it. Do not use in production. Available from SDK 1.8.5. - Throws:
IllegalArgumentExceptionat the call if a parameter is null or the key is empty
InitializeCallback
- Description: Single-method interface,
void onComplete(Throwable error); a lambda fits it
setInterval(float interval)
- Description: Sets the background scan interval in minutes (default
0.75= 45 seconds). Call beforeinitializefor chaining:AlphynSDK.setInterval(1.0f).initialize(context); - Returns:
AlphynSDKinstance
isInitialized()
- Description: Checks if the SDK has been successfully initialized
- Returns:
boolean- true if initialized, false otherwise - Thread: Thread-safe
Listeners
Section titled “Listeners”addSecurityListener(AlphynSecurityListener listener)
- Description: Adds a security event listener (callbacks are delivered on the main thread)
- Thread: Thread-safe
removeSecurityListener(AlphynSecurityListener listener)
- Description: Removes a security event listener
- Thread: Thread-safe
Scan & Device Information
Section titled “Scan & Device Information”getScanResult()
- Returns:
String- Latest security scan result summary - Throws:
AlphynException
getAppHash()
- Returns:
String- The app’s integrity hash (SHA-256 of the signing certificate in keyless mode) - Throws:
AlphynException
getDeviceId()
- Returns:
String- Persistent unique device identifier - Throws:
AlphynException
getModules()
- Returns:
String- JSON array of active security modules (e.g.["ROOT-V1", ...]) - Throws:
AlphynException
getAllRiskFactors()
- Returns:
List<String>- Risk factors the last completed scan found (["DEVICE_CLEAN"]when clean) - Throws:
AlphynException-SCAN_PENDINGuntil the first scan of the process completes
getLastScanDate()
- Returns:
String- Timestamp of the last scan (e.g."2025-09-18 12:55:01") - Throws:
AlphynException
getRejectReasons()
- Returns:
String- The last completed scan’s rejection reasons, oneCODE|Descriptionper line; an empty string when the scan found nothing - Throws:
AlphynException-SCAN_PENDINGuntil the first scan of the process completes
getAllScanResults() / getAllScanResults(Date startDate, Date endDate)
- Returns:
List<String>- Historical scan results, optionally filtered by date range - Throws:
AlphynException
Screen Protection
Section titled “Screen Protection”enableScreenshotProtection(Activity activity) / disableScreenshotProtection(Activity activity) / isScreenshotProtectionEnabled(Activity activity)
- Description: Toggles/queries screenshot protection (
FLAG_SECURE) for the given Activity - Returns:
boolean- whether the operation succeeded / protection is enabled
enableOverlayProtection(Activity activity) / disableOverlayProtection(Activity activity)
- Description: Toggles protection against overlay attacks for the given Activity
- Returns:
boolean- whether the operation succeeded
isOverlayProtectionAvailable() / isOverlayProtectionAvailable(Context context)
- Description: Checks whether overlay protection is available on this device (requires Android 12+ / API 31)
- Returns:
boolean
Action Verification
Section titled “Action Verification”High-risk actions are verified with signAction, which signs the transaction with a
hardware-backed key belonging to an enrolled user and returns a short-lived token your backend
validates server-side. See MFA Transaction Signing for the three-call flow, and
MFA on Android for the signatures.