tencent cloud

Feedback

Startup Monitoring

Last updated: 2024-05-14 12:36:06
    Startup monitoring requires the use of the qapm-plugin plugin for instrumentation during compilation. The default instrumentation points are the various lifecycles of the Application and Activity. In the App SDK, the default startup time is measured from Application's attachBaseContext to the end of onResume of the first Activity.

    Prerequisites

    The qapm-plugin has been configured in the app-level build.gradle.

    Configuration Process

    1. Manually add an Application subclass, such as BaseApplication (the name is not restricted, and the subclass does not need to implement any methods or add any attributes).
    2. In the AndroidManifest.xml file, add the android:name attribute to the application node, with the value being "package name+Application subclass name".
    
    
    

    Additional Tracking

    If you want to measure the execution time of certain methods within the startup interval, additional tracking is required, as shown below:
    Refer to the code:
    QAPM.beginScene(StageConstant.QAPM_APPLAUNCH, "Method Name", QAPM.ModeResource);
    /**Service logic*/
    QAPM.endScene(StageConstant.QAPM_APPLAUNCH, "Method Name", QAPM.ModeResource);
    If you want to set your own end point for the startup, additional tracking must be done within 20s after the first Activity calls onResume, as shown below:
    Refer to the code:
    /**
    * Users who need to customize the end point must do so within 20s after onResume. Otherwise, APM's end point will be used.
    */
    QAPM.endScene(StageConstant.QAPM_APPLAUNCH, QAPM.ModeResource);

    Verifying Whether the Feature Is Working Properly

    If the following log message appears 20 seconds after each startup or switch to background, it indicates successful reporting of startup metric data.
    Retrieval tag: [plugin::114]
    
    
    
    Note:
    It requires the qapm-plugin for instrumentation and you must manually add an Application subclass. Otherwise, it will not work.
    Individual event data will be reported only if the total startup time exceeds 2.5s.

    Calculation

    Cold Startup:

    Occurs after the app starts from the device or after the system terminates the app for the first time.
    Android calculation method: mainActivityOnResume_end - attachBaseContext_start.
    iOS calculation method: Time of the first frame of the first page UI displayed on screen - App process creation time.

    Initial Startup:

    Indicates the first launch after the app installation, which is a special case of cold startup.
    Android calculation method: mainActivityOnResume_end - attachBaseContext_start
    iOS calculation method: Time of the first frame of the first page UI displayed on screen - App process creation time.

    Warm Startup:

    Under the premise that process and Activity instances still exist (for iOS, the app is in the background and alive). If the app switches to the background for three minutes and then switches back to the foreground, it is defined as a warm startup.
    Android calculation method: activityOnResume_end - activityOnRestart_start.
    iOS calculation method: ApplicationDidBecomeActive - ApplicationWillEnterForeground.

    Startup Duration:

    Total boot time / Total boot count
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support