# Runtime Toggles

Use runtime toggles to configure SDK features without reinitializing the SDK. Use runtime toggles to turn these features on or off:

- Analytics services
- Predictive intelligence (PI) analytics
- Inbox messaging
- Geolocation-based messaging
- Proximity-based messaging

Use runtime toggles to fine-tune the behavior of your app, adapt to changing requirements, and comply with privacy regulations. The SDK provides APIs for getting and setting the status of each feature.

These code examples show how to use runtime toggles.

::::tabset{tabs="[&#x22;Android SDK v10+&#x22;, &#x22;iOS SDK v10+&#x22;, &#x22;Android SDK v8&#x22;, &#x22;iOS SDK v8&#x22;]"}
:::tab
For version 10 or later of the SDK for Android, use this code.

```java
MarketingCloudSdk.requestSdk { engagementSdk ->
  // Analytics
  engagementSdk.analyticsManager.enableAnalytics() // or disableAnalytics()
  engagementSdk.analyticsManager.areAnalyticsEnabled()

  engagementSdk.analyticsManager.enablePiAnalytics() // or disablePiAnalytics()
  engagementSdk.analyticsManager.arePiAnalyticsEnabled()

  // Messaging
  engagementSdk.inboxMessageManager.enableInbox() // or disableInbox()
  engagementSdk.inboxMessageManager.isInboxEnabled()

  engagementSdk.regionMessageManager.enableGeofenceMessaging() // or disableGeofenceMessaging()
  engagementSdk.regionMessageManager.isGeofenceMessagingEnabled()

  engagementSdk.regionMessageManager.enableProximityMessaging() // or disableProximityMessaging()
  engagementSdk.regionMessageManager.isProximityMessagingEnabled()
}
```
:::

:::tab
For version 10 or later of the SDK for iOS, use this code.

```swift
MarketingCloudSdk.requestSdk { mc in
    //Analytics
    mc?.setAnalyticsEnabled(_: Bool)
    mc?.isAnalyticsEnabled()

    mc?.setPiAnalyticsEnabled(_: Bool)
    mc?.isPiAnalyticsEnabled()

    //Messaging
    mc?.setLocationEnabled(_: Bool)
    mc?.isLocationEnabled()

    mc?.setInboxEnabled(_: Bool)
    mc?.isInboxEnabled()
}
```
:::

:::tab
For version 8 of the SDK for Android, use this code.

```java
SFMCSdk.requestSdk {
  it.mp { push ->
    // Analytics
    push.analyticsManager.enableAnalytics() // or disableAnalytics()
    push.analyticsManager.areAnalyticsEnabled()

    push.analyticsManager.enablePiAnalytics() // or disablePiAnalytics()
    push.analyticsManager.arePiAnalyticsEnabled()

    // Messaging
    push.inboxMessageManager.enableInbox() // or disableInbox()
    push.inboxMessageManager.isInboxEnabled()

    push.regionMessageManager.enableGeofenceMessaging() // or disableGeofenceMessaging()
    push.regionMessageManager.isGeofenceMessagingEnabled()

    push.regionMessageManager.enableProximityMessaging() // or disableProximityMessaging()
    push.regionMessageManager.isProximityMessagingEnabled()
  }
}
```
:::

:::tab
For version 8 of the SDK for iOS, use this code.

```swift
SFMCSdk.requestPushSdk { mp in
    //Analytics
    mp.setAnalyticsEnabled(_: Bool)
    mp.isAnalyticsEnabled()

    mp.setPIAnalyticsEnabled(_: Bool)
    mp.isPiAnalyticsEnabled()

    //Messaging
    mp.setLocationEnabled(_: Bool)
    isLocationEnabled()

    mp.setInboxEnabled(_: Bool)
    mp.isInboxEnabled()
}
```
:::
::::

## Analytics Runtime Toggle Considerations

When you use the runtime toggle to turn off analytics, the SDK removes all non-billable analytics and stops recording new non-billable analytics.

*Non-billable analytics* include data used in reports that help you track messaging effectiveness, such as open rates for push notifications and inbox messages.

*Billable analytics* tell Marketing Cloud Engagement about billable actions without collecting user-specific information. Even when you turn off analytics, the SDK sends data for billable events only, with no user-related details from the device.

## See Also

- [Analytics](/docs/marketing/mobile-unified-sdk/guide/mc_engagement_analytics.md)
- [Inbox Messaging](/docs/marketing/mobile-unified-sdk/guide/mc_engagement_inbox_messages.md)
- [Location Messaging](/docs/marketing/mobile-unified-sdk/guide/mc_engagement_location_messages.md)
