Upload Error Handling (v3.2.0)
Key Changes
Six individual error codes that previously occurred during the upload process have been unified into ERR_UPLOAD_TRACKING_TERMINATED (23499).
- Unified Codes:
ERR_UPLOAD_BAD_REQUEST,ERR_UPLOAD_UNAUTHORIZED,ERR_UPLOAD_FORBIDDEN,ERR_UPLOAD_NOT_FOUND,ERR_UPLOAD_TOO_LARGE,ERR_UPLOAD_UNPROCESSABLE.
Trigger Conditions
If an HTTP 4xx error occurs during upload, the SDK triggers the onFail callback with ERR_UPLOAD_TRACKING_TERMINATED (23499). Specific details regarding the cause are provided via the detail parameter.
Common Scenarios:
- Concurrent Tracking on Another Device: If User A starts tracking on Phone 1, and then starts a new session with the same
user_idon Phone 2, the session on Phone 1 is terminated by the server. Subsequent upload attempts from Phone 1 will trigger this error. - Exceeding 24-Hour Limit: If a session exceeds 24 hours, the server automatically terminates it. Any further upload attempts will result in this error.
Implementation
override fun onFail(errorCode: Int, detail: String) {
if (errorCode == AsleepErrorCode.ERR_UPLOAD_TRACKING_TERMINATED) {
// The 'detail' parameter contains specific error messages.
// Perform client-side cleanup, such as stopping Foreground Services.
}
}
Important Notes
- Automatic Cleanup: When this error occurs, the SDK automatically stops recording, releases resources, and closes the session. Do not call
stopTracking()manually, as the SDK handles this internally. - Backward Compatibility: Deprecated error codes remain in the codebase for compatibility but will no longer be returned by the SDK.
Updated about 15 hours ago
