static void Initialize(AlmediaLinkConfig config)
Boots the SDK. Merges config with AlmediaLinkSettings, instantiates the native bridge for the current platform, sends an init request to the backend, and starts the status lifecycle that resolves into a terminal AlmediaStatus (delivered via OnStatusChanged and reflected in CurrentStatus).
With Auto-Initialize From Prefabs enabled in AlmediaLinkSettings, a LinkButton prefab calls this by itself with the settings values when nothing has called it by the end of the button’s first frame. A call of your own always takes precedence.
Validation. If the resolved integration key for the current platform is missing or empty (no value supplied by config and no value in the settings asset), the method synchronously raises OnErrorOccurred with AlmediaErrorCode.InvalidConfiguration and returns without initializing the bridge.
Failure modes. Initialize never throws. All initialization failures are surfaced through OnErrorOccurred:
Subscribe to
OnErrorOccurred before calling Initialize to receive synchronous errors.
Idempotency. Calling Initialize again with the same effective configuration is a no-op: CurrentStatus is preserved and the native layer is not contacted again (the call is logged at Info level). This holds whether the first call is still in flight or has already reached a terminal status. Calling Initialize with a different configuration tears down the current session and re-initializes - CurrentStatus returns to NotInitialized for the transition and then resolves again, driven by the native layer. The native bridge instance is reused across calls; it is never recreated.
OS support floor. On devices below iOS 16 or Android API 25, initialization completes normally but resolves to AlmediaStatus.NotAvailable, and every further SDK call is inert - nothing crosses into native code. A single warning stating the device OS version and the required one is reported through OnLog; it is the only diagnostic emitted below the floor, so wire OnLog into your logging pipeline if you need to distinguish this case from the other NotAvailable causes in the field. On devices at or above the floor, behavior is unchanged. Editor play mode is unaffected.
static void ShowLink()
Shows the link popup to a player who can link. The popup’s CTA button starts linking. The popup reports the same analytics as when the LinkButton prefab opens it. This is the recommended way to start linking from your own button.
The popup comes from Almedia → Settings → Default UI Prefabs → Link Popup (see AlmediaLinkSettings). With that slot empty, ShowLink() shows the popup assigned to the deprecated LinkPopupOverride. With neither assigned, it starts linking directly and logs a warning through OnLog once.
A no-op (with a warning) until the SDK is ready. After that, it does nothing, with a log, unless CurrentStatus is Eligible. It also does nothing while a link popup is already open. A popup that fails to open, for example a Prefab Variant with a missing reference, is removed and reported through OnLog at Error.
static void StartLinking(PlacementType placement = PlacementType.Popup)
Opens the native account-linking flow directly, without the popup. The placement value is analytics metadata - it tells the backend which UI surface drove the call.
In the bundled integration, host code does not call this directly. The LinkPopup’s CTA button calls StartLinking for you, whether the popup came from the LinkButton prefab or from ShowLink(). For your own popup design, assign a Prefab Variant of LinkPopup to the Link Popup slot and call ShowLink(). Call StartLinking yourself only from the CTA of a popup built without LinkPopupController.
A no-op (with a warning logged via OnLog) if Initialize has not been called, or if the SDK has not yet reached a terminal status (the first OnStatusChanged has not fired).
static void ShowRewardHub()
Opens the reward progression screen in a webview. When the screen appears, OnScreenPresented fires with AlmediaScreen.RewardHub, and its dismissal is reported through OnScreenDismissed.
A no-op (with a warning) until the SDK is ready. Safe to call in any state: native opens the screen only for a linked player for whom the reward hub is currently available, and otherwise does nothing with the reason logged through OnLog - a no-op call fires neither lifecycle event. Reward hub availability can change mid-session, so a call that worked earlier may later be a no-op.
Check ScreenAvailability.CanShowRewardHub before calling, and gate your entry point on it rather than on a flag you cache yourself. Availability can still change between rendering a button and the tap.
static void ShowOffer()
Opens the offer screen in a webview. When the screen appears, OnScreenPresented fires with AlmediaScreen.Offer, and its dismissal is reported through OnScreenDismissed.
A no-op (with a warning) until the SDK is ready. Safe to call in any state: native opens the screen only for a linked player for whom an offer is currently available, and otherwise does nothing with the reason logged through OnLog - a no-op call fires neither lifecycle event. Offer availability can change mid-session, so a call that worked earlier may later be a no-op.
Check ScreenAvailability.CanShowOffer before calling, and gate your entry point on it rather than on a flag you cache yourself. Availability can still change between rendering a button and the tap; such a call does nothing and logs.
static void Engage()
Context-aware entry point. Forwards to native, which routes on the player’s state:
All routing lives in native - Unity does not switch on status.
Engage() forwards the call whenever the SDK is ready, regardless of the current status; the state-based decision (including the no-op case) happens on the native side and is reported through OnLog. A no-op (with a warning) until the SDK is ready.
On Eligible it starts linking directly, without the popup. To show the popup, call ShowLink() while the player can link and ShowRewardHub() once linked.
static void FetchNotifications()
Issues a one-shot request for the latest reward notifications. Result arrives via OnNotificationsReceived if there are any. A no-op (with a warning) until the SDK is ready - i.e. before the first OnStatusChanged has fired. Offline, the request fails quietly: a Warning log, no OnErrorOccurred, and nothing delivered until the next poll or call finds the network again. The backend can hold the request for up to a minute until a message arrives.
Resets the polling clock when polling is active. Calling FetchNotifications while the polling loop is running fires the immediate request and reschedules the next polling tick to now + interval instead of letting it fire at the originally planned time. This dedups the immediate request against a near-due scheduled tick - hosts that call FetchNotifications on user action (e.g. opening a notifications drawer) won’t see a near-duplicate poll arrive moments later.
static void StartNotificationPolling()
Resumes the notification polling loop. The loop auto-starts once the player’s status reaches Linked, so host code only needs this method to recover from an explicit StopNotificationPolling() (for example, after a cinematic or full-screen ad). The backend can set the interval. When it sets none, the interval comes from AlmediaLinkConfig.NotificationsPollingIntervalSec / AlmediaLinkSettings.NotificationPollIntervalSeconds (default 30 s, minimum 5 s). The native plugin pauses polling automatically when the app backgrounds and resumes on foreground. A no-op (with a warning) until the SDK is ready - i.e. before the first OnStatusChanged has fired.
Idempotent. Calling StartNotificationPolling while the loop is already running is a no-op - it does not double-schedule, does not shorten the interval, and does not trigger an immediate poll. To force an immediate fetch, call FetchNotifications.
static void StopNotificationPolling()
Stops the polling loop. Call this from cinematics, full-screen ads, or any UI state where notifications would intrude.
Idempotent. Calling StopNotificationPolling when the loop is not running is a no-op. Safe to call defensively before a scene where notifications should be suppressed.