API Reference

Detailed reference for all exported APIs, including the Singleton, Hook, and Provider.

Singleton API: AplikoLinkManager

The core singleton instance for managing deep links throughout your application. Access it via AplikoLink.

MethodReturnsDescription
init(config)voidInitializes the manager with required configuration (e.g., API key). Must be called as early as possible, before using any other methods.
addUrlListener(cb)() => voidSubscribes to URL changes. Calls `cb(url, data)` on every new deep link. Returns an unsubscribe function.
removeAllListeners()voidRemoves all registered listeners.
getInitialUrl()string | nullReturns and consumes the first link that launched the app. After it is consumed, returns null until next launch.
getCurrentUrl()string | nullReturns the most recent deep link without consuming it.
getDataForUrl(url)Promise<UrlSchemeMetaData>Parse a URL and return metadata.
destroy()voidCompletely resets internal state and unsubscribes from platform events (mainly for testing or hot reload).

Hook API: useAplikoLink

A React hook for handling deep links within functional components. It automatically manages the subscription lifecycle.

typescript
useAplikoLink(callback: (url: string | null, data: UrlSchemeMetaData) => void): void
ParameterTypeDescription
callback(url, data) => voidA function that is called every time a new deep link is received. It receives the URL string and metadata.

Provider API: AplikoLinkProvider

A React component to wrap your app and handle deep links globally.

PropTypeDescription
onLink(url, data) => voidCallback for every deep link event.
childrenReact.ReactNodeYour app's component tree.

Type Definitions

Core TypeScript types used throughout the SDK.

typescript
export type UrlCallback = (
  url: string | null,
  data?: UrlSchemeMetaData
) => void;

export type Unsubscribe = () => void;

export interface DeepLinkManagerConfig {
  apiKey: string;
  debug?: boolean;
}

export interface UrlSchemeMetaData {
  [x: string]: any;
}