All Products
Search
Document Center

Hotpatch code sample

Last Updated: Feb 04, 2021

Android code sample

mPaaS framwork based

See Get Code Sample to obtain code sample.

Native framework based

Demo address

See Get Code Sample to obtain code sample.

Download App to experience hotpatch function

In Android device, scan the following QR code with Alipay or DingTalk to install the App:

The procedure is as follows:

  1. At the first time of starting the App, once you tap a button, an error message pops up to remind you that a bug exists in the current version of the App.

    Since this App has the hotpatch component accessed, the hotpatch package will be downloaded when the bug is detected after App startup.
  2. Kill the process of the App and restart it, tap a button in the App again, a message like Bug fixed pops up to indicate that the bug is fixed.

    The package downloaded in the first startup takes effect when the App restarts to fix the bug.

iOS code sample

For details about Hotpatch, See Mobile Delivery Service > Manage Hotpatch > Introduction to Accessing iOS.

Get started

  1. Run the project directly, click Create Crash and program crashes.
  2. Upload Test.js repair script in project directory to Mobile Delivery Service platform and create a release task. For how to create a release task, see Mobile Delivery Service > Hotpatch > Manage Hotpatch.

    image

  3. Click Create Crash again, the program runs normally and the crash is fixed.

    fixed