SDK v1.3 → v1.4 Migration
A change-by-change guide to upgrading an existing v1.3.x app to v1.4.0.
This guide lists the code changes needed to upgrade an existing v1.3.x integration to v1.4.0, per platform.
iOS: The old public symbols are kept as deprecated aliases, so your app still builds. To clear the deprecation warnings, migrate to the new APIs below.
Android: The global initializer (PetnowUiClient) has been removed, so code changes are required.
iOS
1. CameraViewModel → CameraController
// v1.3.x (deprecated)
@StateObject private var viewModel: CameraViewModel
CameraView(viewModel: viewModel)
// v1.4.0
@StateObject private var controller: CameraController
CameraView(controller: controller) CameraViewModel is a deprecated typealias of CameraController. Change CameraView(viewModel:) to CameraView(controller:) as well.
2. Move the license to the constructor
Passing the license via initializeCamera(licenseInfo:) is deprecated. Inject licenseInfo into the constructor and call initializeCamera without the license argument.
// v1.3.x (deprecated)
let controller = CameraController(species: .dog, cameraPurpose: .forRegisterFromProfile)
try await controller.initializeCamera(
licenseInfo: LicenseInfo(apiKey: "YOUR_API_KEY", isDebugMode: false),
initialPosition: .back,
captureSessionId: sessionId,
)
// v1.4.0
let controller = CameraController(
configuration: DetectionConfiguration(species: .dog, purpose: .petProfileRegistration),
licenseInfo: LicenseInfo(apiKey: "YOUR_API_KEY", isDebugMode: false),
)
try await controller.initializeCamera(initialPosition: .back, captureSessionId: sessionId) 3. Teardown: stopDetection() → finalizeCamera()
// v1.3.x (deprecated)
controller.stopDetection()
// v1.4.0
controller.finalizeCamera() startDetectionSession() was also renamed to startDetection() (used to re-capture).
4. DetectionStatus adds .finished
DetectionStatus has a .finished case. A non-exhaustive switch will fail to compile, so handle .finished or add a default.
switch controller.detectionStatus {
case .noObject, .processing, .detected: break
case .finished: break // added
case .failed(let reason): handle(reason)
}iOS change summary
| v1.3.x | v1.4.0 |
|---|---|
CameraViewModel | CameraController |
CameraView(viewModel:) | CameraView(controller:) |
initializeCamera(licenseInfo:…) | constructor CameraController(configuration:licenseInfo:) + initializeCamera(initialPosition:captureSessionId:) |
stopDetection() | finalizeCamera() |
startDetectionSession() | startDetection() |
DetectionStatus (4 cases) | .finished added (5 cases) |
See Basic Usage for details.
Android
In v1.4.0 the global initializer PetnowUiClient has been removed. The way you pass the license and detection configuration changes, so code changes are required.
1. PetnowUiClient removed → per-session passing
// v1.3.x (removed — compile error)
PetnowUiClient.initialize(apiKey = "YOUR_API_KEY", isDebugMode = false)
PetnowUiClient.configureDetection(DetectionConfiguration(/* ... */))- Recommended (
CameraView+CameraController): passLicenseInfoto theCameraController(context, license, scope)constructor andDetectionConfigurationtoinitializeCamera(config, captureSessionId). → Basic Usage - Keep the existing
PetnowCameraFragment: pass the license via Fragment args (ARG_API_KEY/ARG_IS_DEBUG_MODE) orprovideLicense(), and the configuration viaARG_DETECTION_CONFIGURATION. → Fragment (legacy)
PetnowUiClient.isSuccessInitialize was also removed.
2. Listener import package changed
// v1.3.x
import io.petnow.ui.PetnowCameraDetectionListener
// v1.4.0
import io.petnow.callback.PetnowCameraDetectionListener
// V2: import io.petnow.callback.PetnowCameraDetectionListenerV23. (Recommended) Move to the V2 listener
On the CameraController path, use setDetectionListenerV2 (V2). V2 delivers DetectionStatus (sealed: NoObject/Processing/Detected/Finished/Failed(reason)) and CameraResult (Success(fingerprintImageFiles, appearanceImageFiles)/Fail).
Android change summary
| v1.3.x | v1.4.0 |
|---|---|
PetnowUiClient.initialize() | LicenseInfo + CameraController(context, license, scope) or Fragment args/provideLicense() |
PetnowUiClient.configureDetection() | initializeCamera(config, captureSessionId) or ARG_DETECTION_CONFIGURATION |
PetnowUiClient.isSuccessInitialize | removed |
import io.petnow.ui.PetnowCameraDetectionListener | import io.petnow.callback.PetnowCameraDetectionListener |
See Basic Usage and Fragment (legacy) for details.
Migration checklist
iOS
-
CameraViewModel→CameraController,CameraView(viewModel:)→(controller:) - Move the license to the constructor (
CameraController(configuration:licenseInfo:)); drop the license arg frominitializeCamera -
stopDetection()→finalizeCamera(),startDetectionSession()→startDetection() - Handle
.finishedinDetectionStatusswitches
Android
- Remove
PetnowUiClientcalls → pass license/config per session - Change the listener import to
io.petnow.callback - (Recommended) Move to
CameraView+CameraController+ the V2 listener