How to Use Device Mode Integrations

Add and use device mode integrations in the Android (Kotlin) and iOS (Swift) SDKs.

This guide shows you how to add device mode integrations in your Android (Kotlin) and iOS (Swift) apps to send events directly to third-party destinations. It covers how to:

Add a standard device mode integration

To add a standard integration, instantiate the integration plugin and add it to your Analytics instance.

Android (Kotlin)

iOS (Swift)

tip
Tip: Always add the integrationPlugin to the Analytics instance before invoking any APIs on the integrationPlugin. Calling them earlier may lead to unexpected behavior.

Access destination instances

Device mode integrations provide the following APIs to interact with destination instances:

  • onDestinationReady(): Register a callback for destination initialization
  • getDestinationInstance(): Access the destination instance directly

See the Device Mode Integration APIs guide for the complete API specification.

onDestinationReady()

onDestinationReady() lets you perform actions only after the destination is successfully initialized. This is useful for fetching IDs or initializing resources that depend on the destination being ready.

tip
Tip: Use the onDestinationReady() API for critical startup logic that requires the destination to be ready before proceeding.

Android (Kotlin)

iOS (Swift)

Example: Fetch Firebase app instance ID

getDestinationInstance()

getDestinationInstance() lets you directly access the destination SDK instance for advanced use cases like interacting with destination-specific APIs or features.

tip
Tip: Use the getDestinationInstance() API for on-demand access later in the app lifecycle when you need to interact with the destination instance immediately.

Android (Kotlin)

iOS (Swift)

Example 1: Set default event parameters for Firebase

Example 2: Use Braze content cards

Add custom plugins to integrations

Device mode integrations support adding custom plugins to modify or enhance event data before sending it to a specific destination. This enables filtering, transformation, or enrichment of events for specific destinations.

With this feature, you can:

  • Add different plugins to different device mode integrations (for example, Firebase, Amplitude, Braze)
  • Apply unique transformations, filtering, or enrichment logic for each destination
  • Handle destination-specific requirements without affecting other integrations

See the Plugin Architecture guide for more information on custom plugins.

Android (Kotlin)

iOS (Swift)

Troubleshooting

IssueSolution
Integration not initializing
  • Ensure you have added the integration plugin to the Analytics instance before calling any integration APIs
  • Check that the destination is enabled in your RudderStack dashboard
  • Verify that required dependencies are properly installed
Destination instance is null
  • The destination may not be initialized yet. Use onDestinationReady() to wait for initialization
  • Check if the integration failed to initialize by handling the failure case in onDestinationReady()
  • Ensure the integration is properly configured in your RudderStack dashboard
Events not reaching destination
  • Verify the integration is added to your Analytics instance
  • Check that events are being tracked using the standard RudderStack APIs (track, identify, etc.)
  • Review destination-specific requirements in the destination’s documentation

See more


Questions? Contact us by Email or on Slack