React Native SDK: Advanced Options

Singular React Native SDK 
Singular React Native SDK version 1.0.3
Compatibility  React Native 0.46.4+
Integration Guides
  1. Basic Integration
  2. Tracking Events and Revenue
  3. Implementing Deep Links
  4. Advanced Options


Tracking Uninstalls

To let Singular track uninstalls for your app:

  1. First, configure the app in the Singular platform, as detailed in Setting Up Uninstall Tracking.
  2. Use your preferred method to retrieve the APNS/FCM tokens in React Native.
  3. Call the setUninstallToken method, passing the APNS/FCM token to as in the example below. Be sure to pass the right token based on the device platform.
Singular.setUninstallToken Method
Description Send Singular the APNS/FCM token in order to let it track app uninstalls.
Usage Example
if (Platform.OS === 'ios') {
} else if (Platform.OS === 'android'){

Modifying the Session Timeout

The Singular SDK manages user sessions automatically, so you don't need to add any code to handle sessions. However, you can modify the session timeout value if you want.

By default, if the app runs in the background for 60 seconds or more before returning to the foreground, the SDK registers a new session.

To change the timeout value, use .withSessionTimeoutInSec when you create the SingularConfig object. For example:

const config = new SingularConfig('<API_KEY>', '<SECRET>')
    .withSessionTimeoutInSec(120); // Set timeout to 120 seconds

GDPR Compliance

The Singular SDK provides several methods to help you comply with GDPR policies and let Singular know about user consent or non-consent for tracking.

Singular.TrackingOptIn Method
Description Let Singular know of user consent (opt-in) for tracking.
Usage Example
Singular.TrackingUnder13 Method
Description Notifying Singular that a user is a minor (under 13).
Usage Example
Singular.StopAllTracking Method

Stop all tracking activities for this user on this app.

Important: This effectively disables the Singular SDK, even after you restart the app. The only way to re-enable the SDK is by calling resumeAllTracking.

Usage Example
Singular.ResumeAllTracking Method
Description Resume tracking activities for this user on this app.
Usage Example
Singular.IsAllTrackingStopped Method
Description Check the tracking status for this user on this app. Returns true if tracking has been stopped.
Usage Example


Was this article helpful?