Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 1.28 KB

Example-Usage.md

File metadata and controls

42 lines (30 loc) · 1.28 KB

Example Usage

This is an example of the most common use case of this SDK - fetching operations and approving them.

SDK Integration

Follow the SDK Integration tutorial for SDK installation.

Example Code

// PowerAuth instance needs to be configured and a user-activated instance.
// More about PowerAuth SDK can be found here: https://github.com/wultra/powerauth-mobile-sdk


fun exampleUsage(appContext: Context, powerAuth: PowerAuthSDK) {
    // Create the WultraMobileToken instance
    val wmt = powerAuth.createWultraMobileToken(appContext, acceptLanguage = "de")

    // Fetch operations using a callback
    wmt.operations.getOperations {
        it.onSuccess { operations ->
            // Handle operations
            for (operation in operations) {
                // Process each operation
            }
        }.onFailure { error ->
            // Handle error
        }
    }
}

For more examples see IntegrationTests

Read Next