调用跳链安装预加载
=========

在项目的EntryAbility.ets文件中导入预加载实现类[PrefetchWrapper](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/cloudfoundation-prefetch-implementation-class#prefetchwrapper)，并在onCreate中调用PrefetchWrapper的doLinkPrefetch方法。方法内部会先调用[popDeferredLink](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/applinking-deferredlink-api#popdeferredlink)接口获取延迟链接，再调用[getPrefetchResult](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/cloudfoundation-cloudresprefetch#getprefetchresult)获取跳链安装预加载缓存数据。

![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/bc/v3/_3BekHsJTbCBkkYZye-cpQ/note_3.0-zh-cn.png?HW-CC-KV=V1&HW-CC-Date=20260612T073605Z&HW-CC-Expire=86400&HW-CC-Sign=EF1CAB753C7F6CC17E7EE501FF35277BD3E8C72627E57E3A7E6D593BDF06C925)

跳链安装预加载缓存的是应用详情页数据，仅允许调用一次，被调用后将被销毁。

import { GlobalContext } from '../common/GlobalContext';
import { PrefetchWrapper } from '../prefetchUtil/PrefetchWrapper';

onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
  GlobalContext.initContext(this.context); // 初始化全局上下文
  PrefetchWrapper.getInstance().doLinkPrefetch();
}