Skip to content

Integration Guidelines

1. Early Initialization

// Initialize in Application.onCreate() for best performance
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
AlphynSDK.initialize(this);
}
}

2. Proper Listener Management

// Always add listeners before initialization
AlphynSDK.addSecurityListener(securityListener);
// Remove listeners in onDestroy to prevent memory leaks
@Override
protected void onDestroy() {
super.onDestroy();
AlphynSDK.removeSecurityListener(securityListener);
}

3. Thread Safety

// SDK callbacks are delivered on the main thread
public void onSuccess(AlphynCallbackResult result) {
// Safe to update UI directly
updateUI(result);
// For heavy processing, use background thread
if (requiresHeavyProcessing(result)) {
executorService.execute(() -> processResult(result));
}
}