Unity SDK: Advanced Options

Singular Unity SDK
Download
Singular Unity SDK version 1.3.8
Compatibility

Unity 4.7.2+

Sample App Review our sample app for an example of a complete SDK integration based on best practices.
Integration Guides
  1. Basic Integration
  2. Tracking Events and Revenue
  3. Implementing Deep Links
  4. Advanced Options

 

Tracking Uninstalls

Note: Uninstall tracking is only available to Enterprise customers.

Android Uninstall Tracking

To enable uninstall tracking for your Android app, first configure the app in the Singular platform as detailed in Setting Up Uninstall Tracking. Then follow the instructions below.

Note: Google deprecated the GCM APIs on April 2018. Use FCM for uninstall tracking.

Enabling Uninstall Tracking Using Firebase Cloud Messaging (FCM)

1. Integrate with FCM:

To track uninstalls, you can use the services of the Firebase Cloud Messaging (FCM) platform. If you are not already using FCM follow Google's instructions on how to Set up a Firebase Cloud Messaging client app on Android.

FCM Requirements (source)

FCM clients require devices running Android 4.1 or higher that also have the Google Play Store app installed, or an emulator running Android 4.1 with Google APIs. Note that you are not limited to deploying your Android apps through Google Play Store.

Users/devices who are not running on supported versions of Android will not be available for Singular uninstall tracking.

2. Update the AndroidManifest.xml File:

Update your AndroidManifest.xml file to add the necessary intent filter for your app (replace MyFirebaseMessagingService with your class that implements the Firebase Service):

<service android:name=".java.MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> </service> <service android:name=".java.MyFirebaseMessagingService" android:exported="false"> intent-filter> action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service>

3. Register and Send the FCM Device Token:

Finally, set the FCM device token after your SingularConfig is initialized in OnCreate(), as follows:

Singular.setFCMDeviceToken(String fcmDeviceToken);

iOS Uninstall Tracking

Uninstall tracking on iOS is based on Apple push-notification technology. If your app doesn't currently support push notifications, see Apple's guide. If your app already supports push notifications, all you need to do is pass the device token returned from APNS using the RegisterDeviceTokenForUninstall method, after the SDK is initialized. 

SingularSDK.RegisterDeviceTokenForUninstall Method
Description Pass the device token returned from APNS. Note that the APNS token is usually binary data in the native form, but you need to pass it as a string.
Signature
public static void RegisterDeviceTokenForUninstall
(string APNSToken)
Usage Example
// pass the APNS token as a hex-string 
SingularSDK.RegisterDeviceTokenForUninstall("ba85ab31a7c7
f5c2f012587f29fb0e596d4b67e7b7b2838fa1a8582c1f7dbdee");

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.

SingularSDK.TrackingOptIn Method
Description Notify Singular of user consent (opt-in) for tracking.
Usage Example
SingularSDK.TrackingOptIn();
SingularSDK.TrackingUnder13 Method
Description Notify Singular that a user is a minor (under 13).
Usage Example
SingularSDK.TrackingUnder13();
SingularSDK.StopAllTracking Method
Description Stop all tracking activities for this user on this app.
Note: Calling this method effectively disables the SDK, even after the app restarts (the state is persistent)! The only way to re-enable tracking is by calling resumeAllTracking().
Usage Example
SingularSDK.StopAllTracking();
SingularSDK.ResumeAllTracking Method
Description Resume tracking for this user on this app.
Usage Example
SingularSDK.ResumeAllTracking();
SingularSDK.IsAllTrackingStopped Method
Description Check the tracking status for this user on this app. Returns true if tracking has been stopped using StopAllTracking() and not resumed.
Usage Example
SingularSDK.IsAllTrackingStopped();

 

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