Unity SDK Setup

Reteno Unity Plugin Documentation

Introduction

The Reteno Unity Plugin is a powerful tool for mobile customer engagement and analytics, designed to streamline the integration of Reteno's API into Unity applications. With support for both Android and iOS, the plugin provides robust features such as automatic screen reporting, in-app messaging, and push notifications. This documentation will guide you through setup, configuration, and feature-specific instructions, ensuring a smooth experience for developers.

Contents

  1. Quick Setup
  2. Core Features and Modules
  3. Platform-Specific Configuration
  4. Usage Examples
  5. Troubleshooting & FAQ
  6. Example Project
  7. Licensing

Quick Setup

The SDK supports:
  • Unity 2021.3 or newer
  • iOS 12.0 or later
  • Android 8.0 or later (minSdk = 26)

Installing Reteno SDK via Unity Package Manager

  1. Open Unity and navigate to Edit > Project Settings > Package Manager.
  2. Add a new Scoped Registry for Reteno:
    • Name: package.openupm.com
    • URL: https://package.openupm.com
    • Scope: com.reteno
  3. Click Save and then open Window > Package Manager.
  4. Switch to My Registries and install the Reteno Unity SDK for your desired platforms.

Firebase Cloud Messaging Setup (Optional)

For notifications, you need a Firebase project:

  • If you don’t have a Firebase project, set it up.
  • Add GoogleService-Info.plist (iOS) or google-services.json (Android) to your Unity project.
  • Import the Firebase Unity SDK and integrate the FirebaseMessaging.unitypackage.

Core Features and Modules

Initialization

Initialize the Reteno SDK as early as possible in your app’s lifecycle. Use the following code in a C# script:

RetenoSDK.Initialize("your_access_key");

Reteno Configuration Options

The RetenoConfiguration class provides advanced setup options:

  • Automatic Screen Reporting: IsAutomaticScreenReportingEnabled
  • App Lifecycle Reporting: IsAutomaticAppLifecycleReportingEnabled
  • Push Subscription Reporting: IsAutomaticPushSubscriptionReportingEnabled
  • Session Reporting: IsAutomaticSessionReportingEnabled
  • Debug Mode: IsDebugMode

Each option can be configured for tailored analytics and engagement.

Notifications Module

Manage push notifications with the NotificationsManager:

  • Request Push Permissions: Prompts the user for permission to receive push notifications.
  • Update Push Status: Use UpdatePushPermissionStatus to sync permissions with Reteno.

User Management

The UserManager module handles user data and permissions:

  • User Identification: UserId
  • Setting Attributes: SetUserAttributes for registered users, and SetAnonymousUserAttributes for anonymous users.

In-App Messages

Configure in-app message behavior with the InAppMessagesManager:

  • Pause Messages: Temporarily stop in-app messaging with PauseInAppMessages.
  • Custom Data Events: Use CustomData to capture in-app message data.

Event Management

Track custom events and screen views with the EventManager:

EventManager.LogEvent(customEvent);
EventManager.LogScreenView("screenName");

Debugging Tools

Use SDKDebug for detailed logging:

  • SDKDebug.Info("message")
  • SDKDebug.Warn("message")
  • SDKDebug.Error("message")

Platform-Specific Configuration

Android Setup

Android - more detailed.

  1. Navigate to Edit > Project Settings > Player > Android.
  2. Enable:
    • Custom Main Gradle Template
    • Custom Gradle Properties Template
  3. Resolve dependencies with Assets > External Dependency Manager > Android Resolver > Force Resolve.

iOS Setup

iOS - more detailed.

After building in Unity and opening the Xcode workspace:

  1. Select Unity-iPhone > Signing & Capabilities.
  2. Enable "Automatically manage signing" and select your Team.
  3. Enable "App Groups" under NotificationServiceExtension.

Usage Examples

  • Initializing Reteno SDK
    RetenoSDK.Initialize("your_access_key");
    
  • Requesting Push Permission
    NotificationsManager.RequestPush(
        onPermissionGranted: () => Debug.Log("Permission granted"),
        onPermissionDenied: () => Debug.Log("Permission denied")
    );
    

Troubleshooting & FAQ

Common Issues

  • Firebase Configuration Not Found: Ensure GoogleService-Info.plist or google-services.json is in the correct location.
  • Push Permission Denied: Verify user settings and permission requests.

Example Project

The com.reteno.example project demonstrates basic usage, providing code samples and scenarios for integrating Reteno’s features.

Licensing

Reteno Unity Plugin is released under the MIT license. See LICENSE for details.