Skip to main content
This guide provides complete SDK implementation examples for iOS (Swift) and Android (Kotlin), covering both JWT and Widget authentication modes.
For React Native applications, consider using the JavaScript SDK (@useago/sdk) as an alternative to the native implementations below.

Prerequisites

Before implementing the SDK, review:

Swift (iOS) - Complete SDK

JWT Authentication Mode

Widget Authentication Mode


Kotlin (Android) - Complete SDK

JWT Authentication Mode

Widget Authentication Mode


Best Practices

Authentication Mode Selection

  • Use JWT mode for registered users with accounts
  • Use Widget mode for anonymous users or embedded chat scenarios
  • Never mix authentication modes in the same session

Widget ID Management

  • Generate UUID once per installation
  • Store persistently (UserDefaults/SharedPreferences)
  • Use same ID across app sessions for conversation continuity
  • Clear ID only on app uninstall or user logout

Error Handling

  • Implement retry logic for network failures
  • Handle 401 errors (invalid or expired token)
  • Handle 403 errors (domain not in allowed list)
  • Show user-friendly error messages

User Experience

  • Show typing indicators during message processing
  • Display content progressively as it streams
  • Update thread title when received
  • Show knowledge sources for transparency