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.
| Method | Returns | Description |
|---|---|---|
init(config) | void | Initializes the manager with required configuration (e.g., API key). Must be called as early as possible, before using any other methods. |
addUrlListener(cb) | () => void | Subscribes to URL changes. Calls `cb(url, data)` on every new deep link. Returns an unsubscribe function. |
removeAllListeners() | void | Removes all registered listeners. |
getInitialUrl() | string | null | Returns and consumes the first link that launched the app. After it is consumed, returns null until next launch. |
getCurrentUrl() | string | null | Returns the most recent deep link without consuming it. |
getDataForUrl(url) | Promise<UrlSchemeMetaData> | Parse a URL and return metadata. |
destroy() | void | Completely 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| Parameter | Type | Description |
|---|---|---|
callback | (url, data) => void | A 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.
| Prop | Type | Description |
|---|---|---|
onLink | (url, data) => void | Callback for every deep link event. |
children | React.ReactNode | Your 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;
}