All Products
Search
Document Center

Quick Tracking:Basic Integration

Last Updated:Jan 28, 2026

1 Path Settings

Check whether you have used the Umeng+ SDK. If you have used the SDK, change the SDK file path in a timely manner.

  • The Umeng+ SDK has been integrated, and now QT SDK needs to be integrated: QTConfigure.resetStorePath in front of all codes of QT and Umeng+ (at least earlier than the receiving domain)

  • QT SDK has been integrated, and now you need to integrate Umeng++ SDK: UMConfigure.resetStorePath in front of all QT and Umeng++ code (at least earlier than the receiving domain)

Warning

If is not called according to the preceding logic, Umeng+ SDK and QT SDK will use a storage path together, resulting in log confusion. The specific logic is: which SDK initialization method is called first, the file path of another SDK is reset, for example, the first initialized Umeng++ SDK calls QTConfigure.resetStorePath;, if it is the first initialized QT SDK, you need to call UMConfigure.resetStorePath;

Note: If you reset the path of the QT SDK, the key values of the feature information storage that are actively set for the SDK, such as the user account and application version, will change. If you rely on these fields for business processing, please reset them. We strongly recommend that you configure it during the initial integration to avoid data loss.

2 Domain settings

Before pre-initialization, developers need to call the QtConfigure.setCustomDomain() interface to set the private environment collection domain before calling any other SDK interfaces.

/**
 * Set the primary and alternate domains for uploading statistics logs. This function must be called before the SDK pre-initialization /initialization function call. The SDK will first report the statistics to the primary domain. If it fails, it will try to report the data to the alternate domain again. 
 * The primary domain primaryDomain or cannot specify null or an empty string. If null or an empty string is specified, the SDK pre-initialization function throws a SdkDomainUndefined run time exception.   
 * @param standbyDomain You can specify null or an empty string for the alternate domain. In this case, the SDK considers that the alternate domain is identical to the primary domain. After the SDK fails to upload data, the data is reported to the primary domain for the second time. 
 * The incoming domain parameter should contain the "https://" prefix.   
 */
public static void setCustomDomain(String primaryDomain, String standbyDomain)

Value

Description

primaryDomain

The receiving address of the primary domain for uploading logs.

standbyDomain

The receiving address of the backup domain for uploading logs.

Example

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        QtConfigure.setCustomDomain("xxxxxx", null); // Specify your domain.
        
        // Open the debugging log.
        QtConfigure.setLogEnabled(true);

        QtConfigure.preInit(this, "xxxxxx", "Channel");// Specify your own appkey.
        QtTrackAgent.disableActivityPageCollection();

// ...

3. Initialize compliance

3.1 Initialization API

Due to the compliance requirements of the Ministry of Industry and Information Technology (MIIT), apps cannot obtain any personal information before users agree to the privacy policy. Therefore, Quick Tracking modification is initialized as follows:

  1. You need to ensure that the app has a Privacy Policy and that the Privacy Policy pops up when the user starts the app for the first time to obtain user consent.

  2. You must inform the user of your choice of Quick Tracking SDK service. Please add the following reference clause to the Privacy Policy: "For our product integration Quick Tracking SDK,Quick Tracking SDK need to collect your OAID/GAID/MAC/IMEI/Android ID/IDFA/IDFV/OPENUDID/GUID/SIM card IMSI information /hardware serial number /MCC (mobile country code) and MNC (mobile network number) to provide statistical analysis services.

  3. The Quick Tracking SDK can be formally initialized only after the user agrees to the privacy policy. The specific technical operations are as follows:

  • SDK API pre-initialization

Call the pre-initialization function QtConfigure.preInit() in the Applicaiton.onCreate function. The pre-initialization function does not collect device information or report data to the Quick Tracking backend.

// SDK pre-initialization function
// The preInit pre-initialization function takes very little time and does not affect the user experience of the first cold start of the app.
public static void preInit(Context context,String appkey,String channel)
  • Formal initialization after agreeing to the privacy agreement

Once the app is authorized by the user in the Privacy Policy, the developer must call the pre-initialization function QtConfigure.preInit() in the Applicaiton.onCreate function. The formal initialization function QtConfigure.init can be called on demand (it can be called immediately after the pre-initialization function, or it can be delayed in a background thread, but it must still be called and cannot be omitted)

public static void init(Context context,String appkey,String channel,int deviceType,String pushSecret);

Value

Description

Remarks

appkey

QT is the unique identifier issued by the current application platform.

  1. The appkey of the input parameter must be consistent with QT background.

  2. The appkey is reported along with each event log and is used to identify the application platform data of QT.

channel

App market for app delivery

The data source of "upgrade channel" in "system attributes" of QT analysis platform

deviceType

QtConfigure.DEVICE_TYPE_PHONE

By default, you can enter QtConfigure.DEVICE_TYPE_PHONE

pushSecret

Abandoned field, enter empty

Abandoned field, enter empty

Example

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        // The pre-initialization function must be called in the Applicaiton.onCreate function.
        QtConfigure.preInit(this,"Your appkey","App store name");
        
        // The Quick Tracking SDK can be officially initialized only after you agree to the privacy policy.
        if(isflag==1)
        {
          QtConfigure.init(this, "Your appkey", "App store name",QtConfigure.DEVICE_TYPE_PHONE, "");
        }
    }
}

3.2Appkey acquisition

When you initialize the SDK, you must specify the Appkey parameter. The application key is the unique ID of an application in Quick Tracking. It is generated when you create an application. For more information about how to obtain or view the application key, see Application Management.

4 Log printing

You can call the QtConfigure.setLogEnabled(boolean) operation to control the output of [Quick Tracking] logs.

Note:

  • Before the app is officially launched, disable SDK running and debugging logs. Avoid irrelevant log output.

You can call the following method to control whether the SDK running debug log is output. By default, the SDK running debug log is disabled. Requires the user to manually open it.

/**
* Set the switch for a component-based log.
* Parameter: boolean is set to false by default. If you want to view LOG, set it to true.
*/
QtConfigure.setLogEnabled(true);

Note:

  • If you view the LOG during initialization, be sure to turn on the LOG switch before calling the initialization method.

  • Logs are classified into four levels for easy viewing:

    • Error (print SDK integration or run time error message).

    • Warn (print SDK warning information).

    • Info (print SDK prompt information).

    • Debug (print SDK debugging information).

5 Special Scenarios

5.1 In-App forced methods such as kill or exit to kill processes

If the developer calls a method such as kill or exit to kill the process, be sure to call the QtTrackAgent.onKillProcess method before this to save statistics.

public static void onKillProcess(Context context);

Value

Description

context

The ApplicationContext context of the current host process.

6. Custom data encryption

6.1 Custom codec interface functions:

The SDK does not directly implement custom encryption and decryption algorithms. The SDK and the receiver provide the CryptoProvider interface. You can implement the following two methods in this interface.

public interface CryptoProvider {
    byte[] encode(Map<String, String> header, byte[] input);
    byte[] decode(Map<String, String> header, byte[] input);
}

Interface methods

Parameters

public byte[] encode(Map<String, String> header, byte[] input);

Parameters: header: additional information that needs to be passed to the decryption side (such as the encryption algorithm used, the encryption mode, and any other information). is passed in as multiple strings K-V key-value pairs. The SDK performs Base64-encoding on all K-V key-value pairs in the map and passes them as HTTP header fields dc-args to the receiving server. The receiving server passes this Map parameter to the corresponding decryption method as it is. input: raw data to be encrypted. Return value: the encrypted data.

public byte[] decode(Map<String, String> header, byte[] input);

Parameters: header: the extra encryption information passed by the encryption. The decryptor needs to use this information to determine the decryption algorithm, mode, and other details. input: raw data to be decoded. Return value: the decrypted data.

6.2 custom codec interface registration functions

QtConfigure.registerCryptoProvider(Context appContext,  CryptoProvider customProvider);

Interface methods

Parameters

registerCryptoProvider

Parameters: appContext: the application applicationContext context object. customProvider: the CryptoProvider object that you implement.

6.3 sample code

import com.quick.qt.commonsdk.sm.CryptoProvider;
import com.quick.qt.commonsdk.QtConfigure;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        
        QtConfigure.setCustomDomain("Your collection service domain", null);

        QtConfigure.setLogEnabled(true); // Enable SDK debugging logs.

        QtConfigure.preInit(this, "Your appkey", "Your channel");

	  // The encryption and decryption interfaces implemented by developers.
        CryptoProvider customProvider = new CryptoProvider() {
            final String key = "just_for_test";
            	public byte[] customEncode(final byte[] data, final byte[] key) {
            	    // Implement by the developer.
            	    return null;
            	}
            	public byte[] customDecode(final byte[] data, final byte[] key) {
            	    // You must implement it by the developer.
            	    return null;
            	}
            @Override
            public byte[] encode(Map<String, String> header, final byte[] input) {
                byte[] result = null;
                try {
                    if (header != null) {
                        // Example
                        header.put("arg1", "value1");
                        header.put("arg2", "value2");
                    }
                    if (input == null) {
                        // If the content to be encrypted is null, you need to print the relevant error log to facilitate joint debugging.
                        return result;
                    }
                    result = customEncode(input, key.getBytes()); // CustomEncode must be implemented by the user.
                } catch (Exception e) {
                    Log.e("customProvider:encode: ", "exception: " + e.getMessage());
                }
                return result;
            }

            @Override
            public byte[] decode(Map<String, String> header, final byte[] input) {
                byte[] result = null;
                try {
                    if (header != null && header.size() > 0) {
                        Log.i("customProvider", "K-V from encode call.");
                        for (String key : header.keySet()) {
                            Log.i("customProvider", "decode: " + key + " = " + header.get(key));
                        }
                    }
                    result = customDecode(input, key.getBytes());
                } catch (Exception e) {
                    Log.e("customProvider:decode: ", "exception: " + e.getMessage());
                }
                return result;
            }
        };


	  // Register a custom CryptoProvider API object.
        final Context appContext = this.getApplicationContext();
        QtConfigure.registerCryptoProvider(appContext,  customProvider);

        // If the end user has agreed to the privacy authorization, call the formal initialization function of the SDK. 
        // Note: If it is the first cold start after the host application is installed, the formal initialization function of QtConfigure.init must be delayed until the end user clicks the "Agree" button in the privacy authorization dialog box before it can be called. Otherwise, it will lead to privacy compliance issues. 
	    if (privacyAuthorizationComplete(appContext)) {
	  	   QtConfigure.init(appContext, "your appkey", "your channel", QtConfigure.DEVICE_TYPE_PHONE, null);
	    }
        
        // ...
       
    }
}