Skip to content

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, INVALID_PARAMETER, OPERATION_FAILED).

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: AlphynSDK instance (for call chaining)
  • Throws: IllegalArgumentException if parameters are null or invalid
  • Thread: Call from main thread

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: AlphynSDK instance
  • Throws: IllegalArgumentException if parameters are null or invalid

setInterval(float interval)

  • Description: Sets the background scan interval in minutes (default 0.75 = 45 seconds). Call before initialize for chaining: AlphynSDK.setInterval(1.0f).initialize(context);
  • Returns: AlphynSDK instance

isInitialized()

  • Description: Checks if the SDK has been successfully initialized
  • Returns: boolean - true if initialized, false otherwise
  • Thread: Thread-safe

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

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> - All detected risk factors
  • Throws: AlphynException

getLastScanDate()

  • Returns: String - Timestamp of the last scan (e.g. "2025-09-18 12:55:01")
  • Throws: AlphynException

getRejectReasons()

  • Returns: String - Detected rejection reasons
  • Throws: AlphynException

getAllScanResults() / getAllScanResults(Date startDate, Date endDate)

  • Returns: List<String> - Historical scan results, optionally filtered by date range
  • Throws: AlphynException

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

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.