Unity Android SDK Setup

Getting started with Reteno Plugin for Android

Install via Package Manager

Please follow the instructions:

  1. Open Edit/Project Settings/Package Manager.
  2. Add a new scope to OpenUPM Scoped Registry:
Package Manager
   Name: package.openupm.com
   URL: https://package.openupm.com
   Scope(s): com.reteno.android
             com.reteno.core
  1. Click Save or Apply.
  2. Open Window/Package Manager.
  3. Click +.
  4. Select Add package by name...
Package Manager
  1. Paste com.reteno.android into the name field.
  2. Paste 1.0.2 into the version field.
  3. Click Add.

Now your Unity project is configured to use the specified package.

Install via Package Manifest

Alternatively, merge the snippet to Packages/manifest.json:

{
    "scopedRegistries": [
        {
            "name": "package.openupm.com",
            "url": "https://package.openupm.com",
            "scopes": [
                "com.reteno.android",
                "com.reteno.core"
            ]
        }
    ],
    "dependencies": {
        "com.reteno.android": "1.0.2"
    }
}

Setting up SDK

Follow our setup guide to integrate the Reteno SDK with your app.

  1. From the Unity Editor, navigate to Edit > Project Settings > Player and click the Android settings tab.
  2. Expand Publishing Settings and enable:
  • Custom Main Gradle Template
  • Custom Gradle Properties Template
  1. Navigate to Assets > External Dependency Manager > Android Resolver > Force Resolve and resolve your Android dependencies.

It is done, most of the Android setup was already handled during installation!

Requesting permission for receiving notifications

Since Android 13 you have to ask user for a permission if you want to send them push notifications. You can do it at the start of the application but it is considered a good tone to tell user why do we need a permission before actually asking for it.

You can ask a permission by calling a function from RetenoSDK or implement it yourself if you require some specific logic.

Using RetenoSDK function

RetenoSDK provides a function which will ask user a permission for receiving push notification and notify Reteno backend that user has granted a permission.

RetenoSDK.RequestPushPermission()

Using custom solution

If you want to ask a permission without using RetenoSDK function, you can do it. But after receiving a permission result, you have to notify RetenoSDK that status of permission might have changed. To do this, you have to call UpdatePushPermissionStatus function from RetenoSDK:

RetenoSDK.UpdatePushPermissionStatus();