React Native SDK: 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') {
  Singular.setUninstallToken(apnsToken);
} else if (Platform.OS === 'android'){
  Singular.setUninstallToken(fcmToken);
}

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
Singular.init(config);

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.TrackingOptIn();
Singular.TrackingUnder13 Method
Description Notifying Singular that a user is a minor (under 13).
Usage Example
Singular.TrackingUnder13();
Singular.StopAllTracking Method
Description

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.StopAllTracking();
Singular.ResumeAllTracking Method
Description Resume tracking activities for this user on this app.
Usage Example
Singular.ResumeAllTracking();
Singular.IsAllTrackingStopped Method
Description Check the tracking status for this user on this app. Returns true if tracking has been stopped.
Usage Example
Singular.IsAllTrackingStopped();

 

Was this article helpful?
0 out of 0 found this helpful