setup Blocking
Initializes the TrustPin SDK with organization credentials (blocking version).
⚠️ WARNING: This method blocks the calling thread
This blocking method is provided for Java interoperability and non-coroutine contexts. It MUST NOT be called from:
Android main/UI thread (will cause ANR - Application Not Responding)
Any coroutine context (use suspend setup function instead)
High-frequency operations or performance-critical paths
Recommended Alternatives:
// ✅ RECOMMENDED: Kotlin with coroutines
lifecycleScope.launch {
TrustPin.setup(
organizationId = "prod-org-123",
projectId = "mobile-app-v2",
publicKey = "LS0tLS1CRUdJTi...",
mode = TrustPinMode.STRICT
)
}
// ✅ Java with ExecutorService
Executors.newSingleThreadExecutor().execute(() -> {
TrustPin.setupBlocking("prod-org-123", "mobile-app-v2", "LS0tLS1CRUdJTi...", TrustPinMode.STRICT);
});
// ❌ DON'T: Call from Android main thread
override fun onCreate(savedInstanceState: Bundle?) {
TrustPin.setupBlocking(...) // ❌ Will cause ANR!
}When to use this method:
Command-line applications
Background services with dedicated worker threads
Testing scenarios with explicit thread management
Parameters
Your organization identifier from the TrustPin dashboard
Your project identifier from the TrustPin dashboard
Base64-encoded public key for signature verification
The pinning mode controlling behavior for unregistered domains
Throws
if credentials are invalid or empty
if network request fails
if signature verification fails
if called from Android main thread
Initializes the TrustPin SDK with a custom configuration URL (blocking version).
⚠️ WARNING: This method blocks the calling thread
This blocking method is provided for Java interoperability and non-coroutine contexts. See setupBlocking for detailed usage warnings and recommended alternatives.
Parameters
Your organization identifier from the TrustPin dashboard
Your project identifier from the TrustPin dashboard
Base64-encoded public key for signature verification
Custom URL for the signed payload
The pinning mode controlling behavior for unregistered domains
Throws
if credentials are invalid or empty
if network request fails
if signature verification fails
if called from Android main thread