Repository navigation
v10.59.0
English
Native host APIs
- Native host code configures Pushy with
configureand prepares the next-launch bundle withprepareBundle:- Android:
PushyRuntime.configure(Context, JSONObject, ConfigurationCallback)andPushyRuntime.prepareBundle(Context, Callback), which reports aBundlePreparationResult. - iOS:
+[RCTPushy configure:completion:]and+[RCTPushy prepareBundleWithCompletion:], available to Swift asconfigure(_:completion:)andprepareBundle(completion:). The completion types areRCTPushyConfigurationCompletionandRCTPushyBundlePreparationCompletion. - HarmonyOS:
PushyFileJSBundleProvider.configure(options: PushyConfiguration)andprepareBundle(): Promise<BundlePreparationResult>.
- Android:
- Call
configurebefore the normal launch bundle resolution andprepareBundleafter it.prepareBundlenever resolves the bundle again, reloads React Native or shows UI; a selected bundle is used from the next launch. - Native hosts that call these APIs must update their call sites and rebuild the native app. The JavaScript SDK, the JS bridge, server paths, configuration values, result fields and persisted state are unchanged, so apps that do not call the native host APIs only need a normal upgrade.
See Native Configuration and Updates for full examples.
中文
原生宿主接口
- 原生宿主通过
configure配置 Pushy,通过prepareBundle准备下次启动使用的 bundle:- Android:
PushyRuntime.configure(Context, JSONObject, ConfigurationCallback)和PushyRuntime.prepareBundle(Context, Callback),结果类型为BundlePreparationResult。 - iOS:
+[RCTPushy configure:completion:]和+[RCTPushy prepareBundleWithCompletion:],Swift 对应configure(_:completion:)和prepareBundle(completion:);回调类型为RCTPushyConfigurationCompletion和RCTPushyBundlePreparationCompletion。 - HarmonyOS:
PushyFileJSBundleProvider.configure(options: PushyConfiguration)和prepareBundle(): Promise<BundlePreparationResult>。
- Android:
- 在正常解析启动 bundle 之前调用
configure,解析之后调用prepareBundle。prepareBundle不会再次解析 bundle、不会重载 React Native,也不会弹窗;选定的 bundle 从下次启动开始使用。 - 调用了这些原生接口的宿主需要同步修改调用代码并重新构建原生应用。JS SDK、JS 桥接、服务端路径、配置值、结果字段和持久化状态均不变,未调用原生宿主接口的应用正常升级即可。
完整示例见原生配置与更新。