static void Initialize(AlmediaConfig 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 the first status (delivered via OnStatusChanged and reflected in Status). A null config reads as an empty AlmediaConfig.
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.
Retry from the error handler. A call to Initialize from an OnErrorOccurred handler that Initialize raised is ignored and logged at Warning via OnLog. Retry from a later frame instead.
Idempotency. Calling Initialize again with the same effective configuration is a no-op: Status 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 resolved. Calling Initialize with a different configuration tears down the current session and re-initializes. Status returns to NotInitialized, OnStatusChanged reports that when the status had already resolved, and the status 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, with AlmediaLinkSource.ShowLink as the source. The same as ShowLink(AlmediaLinkSource.ShowLink).
static void ShowLink(AlmediaLinkSource source)
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.
source says where the popup opens from. The popup reads it as Source, and the AlmediaLinkPopupController events carry it. A null source reads as AlmediaLinkSource.ShowLink. See AlmediaLinkSource.
The popup comes from Almedia → Settings → Default UI Prefabs → Link Popup (see AlmediaLinkSettings). With that slot empty, it shows the popup assigned to the deprecated LinkPopupOverride. With neither assigned, it starts linking directly and logs a warning through OnLog once. No popup event fires in that case.
A no-op (with a warning) until the SDK is ready. After that, it does nothing, with a log, unless Status is AlmediaStatus.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. It counts no show and fires no event.
static void StartLinking()
Opens the native account-linking flow directly, without the popup, and reports the Popup placement. The same as StartLinking(AlmediaPlacementType.Popup).
static void StartLinking(AlmediaPlacementType placement)
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. See AlmediaPlacementType. A null placement reads as Popup.
In the bundled integration, host code does not call this directly. The LinkPopup’s CTA button starts linking for you, whether the popup came from the LinkButton prefab or from ShowLink(). A popup built on AlmediaLinkPopupController, including a Prefab Variant of LinkPopup, starts linking from its own StartLinking and reports the tap. Call Almedia.StartLinking yourself only from a popup built without it. Such a popup reports no show, tap or dismiss.
A no-op (with a warning logged via OnLog) if Initialize has not been called, or if the SDK has not yet resolved its first 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 CanShowRewardHub on a Linked status 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 CanShowOffer on a Linked status 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 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 AlmediaConfig.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.