链接

此接口处理传入和传出方向的深度链接。传入的深度链接指示应用程序执行其他应用程序请求的操作。传出的深度链接指示其他应用程序执行操作。

类型

// Information used to invoke the default SMS app
interface SmsInfo {
    phoneNumber?: string;
    body?: string;
}

// Information used to invoke the default email app
interface EmailInfo {
    to?: string[];
    cc?: string[];
    bcc?: string[];
    subject?: string;
    body?: string;
}

// Error returned by promise if the request fails
interface LinkingErrorInfo {
    code: LinkingError;
    url: string;
    error?: string;
}

enum LinkingErrorCode {
    NoAppFound = 0,
    UnexpectedFailure = 1,
    Blocked = 2,
    InitialUrlNotFound = 3
}

方法

// Returns the URL that was used to launch the application
getInitialUrl(): SyncTasks.Promise<string>;

// Requests the URL to be opened by the default app for that protocol
// (e.g. http or https would typically open the system browser)
openUrl(url: string): SyncTasks.Promise<void>;

// Requests the default SMS app to be invoked
launchSms(smsData: SmsInfo): SyncTasks.Promise<void>;

// Requests the default mail app to be invoked
launchEmail(emailData: EmailInfo): SyncTasks.Promise<void>;

事件

// Triggered when a new deep link request arrives
deepLinkRequestEvent: SubscribableEvent<(url: string) => void>;