Use the SDK

1

Import the Library

using io.adjoe.sdk;
2

Set Up PlaytimeOptions and ShowCatalog

In your main activity, you can set up playtimeOptions and call showCatalog . We recommend that you have a factory to build PlaytimeOptions.

private PlaytimeOptions BuildPlaytimeOptions() {
        PlaytimeOptions options = new PlaytimeOptions();

        PlaytimeParams adjoeParams = new PlaytimeParams();
        adjoeParams.SetUaNetwork("init-ua-network")
                .SetUaChannel("init-uaChannel")
                .SetUaSubPublisherCleartext("init-ua-subpublisher-cleartext")
                .SetUaSubPublisherEncrypted("init-ua-subpublisher-encrypted")
                .SetPlacement("init-placement")
                .setPromotionTag("promotion-id");
        options.SetPlaytimeParams(adjoeParams);

        PlaytimeExtensions extensions = new PlaytimeExtensions();
        extensions.SetSubId1("init-subid1")
                .SetSubId2("init-subid2")
                .SetSubId3("init-subid3");
        options.SetPlaytimeExtensions(extensions);

        PlaytimeUserProfile userProfile = new PlaytimeUserProfile();
        userProfile.SetGender(PlaytimeGender.MALE)
                .SetBirthday(DateTime.Parse("1990-05-15T00:00:00.000Z"));
        options.SetPlaytimeUserProfile(userProfile);

        options.SetUserId("USER_ID");
        options.SetSdkHash("YOUR_SDK_HASH");


        return options;
    }

    void Start()
    {
        PlaytimeOptions options = BuildPlaytimeOptions();

        Playtime.ShowCatalogWithOptions(
            options,
            () =>
            {
                Console.WriteLine("✅ ShowCatalogWithOptions Success!");
            },
            error =>
            {
                Console.WriteLine($"❌ ShowCatalogWithOptions Error: {error.Message}");
            }
            );
    }
}

Using setPlaytimeOptions

The SDK also provides an option to independently set up the playtimeOptions before calling showCatalog. Calling setPlaytimeOptions will reinitialize the SDK.

Playtime.SetPlaytimeOptions(
    PlaytimeOptions options,
    Action onSuccess,
    Action<Exception> onError
);

Using getStatus to showCatalog

The SDK that ensures that showCatalog and other methods that trigger SDK re-initialization wait until the previous init request finishes before executing. Regardless, you still have the option to conditionally call showCatalog based on the SDK's initialization status.

public class PlaytimeManager : MonoBehaviour
{
    private PlaytimeOptions BuildPlaytimeOptions()
    {
        PlaytimeOptions options = new PlaytimeOptions();

        PlaytimeParams adjoeParams = new PlaytimeParams();
        adjoeParams.SetUaNetwork("ua-network")
                .SetUaChannel("uaChannel")
                .SetUaSubPublisherCleartext("uasubpublishercleartext")
                .SetUaSubPublisherEncrypted("uasubpublisherencrypted")
                .SetPlacement("placement")
                .SetPromotionTag("promotion-id");

        options.SetPlaytimeParams(adjoeParams);

        PlaytimeExtensions extensions = new PlaytimeExtensions();
        extensions.SetSubId1("subid1")
                .SetSubId2("subid2")
                .SetSubId3("subid3");

        options.SetPlaytimeExtensions(extensions);

        PlaytimeUserProfile userProfile = new PlaytimeUserProfile();
        userProfile.SetGender(PlaytimeGender.MALE)
                .SetBirthday(DateTime.Parse("1990-05-15T00:00:00.000Z"));

        options.SetPlaytimeUserProfile(userProfile);

        options.SetUserId("USER_ID");
        options.SetSdkHash("YOUR_SDK_HASH");

        return options;
    }

    void Start()
    {
        var status = Playtime.GetStatus();

        Debug.Log($"ADJOE - Current SDK Status: {status}");

        if (status != null && status.IsInitialized)
        {
            try
            {
                PlaytimeOptions options = BuildPlaytimeOptions();

                Playtime.ShowCatalogWithOptions(
                    options,
                    () =>
                    {
                        Debug.Log("✅ ShowCatalogWithOptions Success!");
                    },
                    error =>
                    {
                        Debug.LogError($"❌ ShowCatalogWithOptions Error: {error.Message}");
                    }
                );
            }
            catch (Exception e)
            {
                Debug.LogError($"ADJOE - Error launching catalog: {e.Message}");
            }
        }
        else
        {
            Debug.LogWarning("ADJOE - SDK is not initialized yet. Please try again in a moment.");
        }
    }
}

Parameters

You should include additional User Acquisition and placement parameters. These parameters allow you to track and analyze Playtime's performance within your app.

You can provide these parameters in any combination, both at any point in the app's lifecycle—such as when a user launches the Playtime Catalog interacts with a campaign or requests a payout.

These values must be url-safe as they could potentially be returned as query parameters in the S2S Payout request.

circle-info

To make the most of the Playtime SDK, to maximize your revenue and provide the best user experience, use all of these parameters for data-driven optimizations. For instance, you can monitor the performance of different Playtime button placements or determine the effectiveness of different UA sources.

Parameter
Explanation

userId

A custom identifier you can assign to each user. If you haven't set one, the Playtime SDK generates it automatically. This ID is necessary for S2S payouts, thus required. Ensure this value is url-safe and that the value is never empty.

uaNetwork

User Acquisition Network. The network through which the user was acquired, e.g., Adwords, Facebook, or Organic.

uaChannel

User Acquisition Channel. The channel within the network from which the user was acquired, e.g. incentivized or video campaigns.

uaSubPublisherCleartext

The cleartext package name of the sub-publisher's app ID within the network from which the user was acquired, e.g., com.domain.appName.

uaSubPublisherEncrypted

The encrypted package name or app ID of the sub-publisher's app from the network where the user was acquired.

placement

The placement of the Playtime Catalog inside your app, e.g., "Main Screen", "Shop", "Interstitial", "More Diamonds Screen", etc.

You can also choose to use adjoe's Apps feature, showing the Playtime catalog with distinct gaming or app experiences.

promotionTag

An optional field that can be sent to adjoe to determine if the user should receive a targeted "user-level" promo.

subId1

An optional identifier that is provided back in the S2S payout URL.

subId2

An optional identifier that is provided back in the S2S payout URL.

subId3

An optional identifier that is provided back in the S2S payout URL.

subId4

An optional identifier that is provided back in the S2S payout URL.

subId5

An optional identifier that is provided back in the S2S payout URL.

App Tracking (iOS Only)

While the IDFA parameter is not required, we strongly recommend including it. It's purpose is to help attribute installs and ensure that users are rewarded.

The App Tracking Transparencyarrow-up-right popup should be triggered in the app before calling showCatalog() . The user must then "Allow" tracking.

When a user selects "Play Now" in the Playtime Catalog, we use a pop-up to remind them to allow tracking.

Last updated