Aller au contenu principal

FIRST APP GUIDE

Deploy Live Updates

Now for the exciting part - let's push our new FAQ feature directly to users without going through the app stores! We'll use Shorebird's code push functionality to make this happen.

Understanding Code Push

Code push lets you update your app's Dart code without submitting a new build to the app stores. Think of it like a web app update - users get the new features next time they open the app.

How Code Push Works

Here's the magic behind it:

  1. When building your app, Shorebird adds a special updater that can safely modify your app's code
  2. When you create a patch, Shorebird looks at what Dart code changed and creates a small update package
  3. This patch gets uploaded to Shorebird's servers
  4. When users open your app, it quietly checks if there's a new patch available
  5. If found, it downloads and safely applies the changes
  6. Next time the app starts, the new code is used!

Important: This only works for Dart code changes (your app's logic, UI, etc.). Changes to native code (like adding new iOS/Android features) still need to go through the app stores.

Shorebird Integration

If you followed along with the quickstart, your app already has Shorebird built in! When you created your project with codika create, we:

  • Added Shorebird configuration
  • Set up the update checking logic
  • Created Codemagic workflows for patch builds

Creating Your First Patch

Remember the FAQ feature we just added? Let's try out Shorebird by pushing it to your test app! First, make sure you've:

  • Successfully built and deployed your test app to TestFlight
  • Installed it on your device like described in section Set Up App Distribution
  • Added and tested the FAQ block in your local development environment like described in section Add FAQ

Then, create your patch:

bash

codika build --prod-patch

What's Happening Behind the Scenes

When you run this command:

  1. Your code is pushed to a prod-patch branch
  2. Codemagic detects this special branch
  3. It triggers the patch workflow in codemagic.yaml
  4. Shorebird builds and signs your patch
  5. The patch is uploaded to Shorebird's servers

How Patches Get Applied

In production, patches are applied automatically:

  1. When users launch the app, it checks for available patches
  2. If a new patch is found, it downloads silently in the background
  3. The next time the user launches the app, the patch is installed
  4. Your new features are immediately available!

No manual intervention is needed - updates happen seamlessly for your users.

What's Next?

Congratulations! You've just:

  • Learned about code push updates
  • Created your first Shorebird patch
  • Deployed a feature without app store involvement

In the next section, we'll customize your app's look and feel to match your brand. We'll explore themes, assets, and configuration options to make the app truly yours.

Remember

While code push is powerful, use it responsibly:

  • Test patches thoroughly before deployment on production. Use the staging app for this.
  • Avoid changes that could crash the app or break existing functionality
  • For major feature updates or UI overhauls, consider publishing a new app store version instead of using patches

Remember: Patches are best for smaller updates like bug fixes, content updates, or minor feature additions.