Code Integration
Once installation and native configuration are complete, the next step is wiring Cresc into your app code.
Prefer Install & Use Skills first so AI can wire UpdateProvider, initialize the client, and apply the common OTA strategies for your project automatically. Keep this page as the manual reference and as a review checklist for generated changes.
Retrieve your appKey
Each platform uses its own appKey. The value is stored in update.json, which is created by cresc createApp or cresc selectApp.
You can also find the appKey in the Cresc dashboard.
Initialize the client
After this, the default OTA flow already works. Cresc can check for updates and show the built-in alert flow automatically.
Choose your check strategy
checkStrategy controls when Cresc checks for updates:
"both": Check on cold start and when the app returns from background."onAppStart": Check only on cold start."onAppResume": Check only when resuming from background.null: Disable automatic checks and callcheckUpdate()yourself.
Choose your update strategy
updateStrategy controls how Cresc handles an available update:
"alwaysAlert": Always show the default update alert flow."alertUpdateAndIgnoreError": Show the default alert flow and ignore download errors in the UI."silentAndNow": Download silently and switch immediately after the update is ready."silentAndLater": Download silently and apply on a later restart.null: Disable the built-in UI so you can build the full experience yourself.
Build a custom update UI
If you want full control over the UI, disable the built-in update strategy and use useUpdate():
Example:
Understand the updateInfo states
After checkUpdate(), Cresc exposes state through useUpdate():
{ expired: true }: The installed native baseline is no longer valid. Prompt the user to install a newer native build if needed.{ upToDate: true }: No OTA update is currently available.{ update: true }: An OTA update is available. Usename,description,metaInfo, and the download flow to drive your UI.
When updateInfo.update is true, call downloadUpdate() and wait for it to resolve before assuming the patch is ready. The progress fields are useful for UI, but the promise result is the reliable completion signal.
Forward OTA analytics into your own tools
Use the logger option if you want to pipe update events into your analytics system: