public interface CrashHandleListener {/*** During the crash handling callback, the data returned by this API is reported as an attachment named userExtraByteData.* @param isNativeCrashed Indicates whether the crash is a native exception.* @param crashType Exception type.* @param crashStack Exception stack.* @param nativeSiCode SI_CODE for the native exception. This data is invalid for non-native exceptions.* @param crashTime Time when the native exception occurs.* @return Byte stream of the reported attachment.*/byte[] getCrashExtraData(boolean isNativeCrashed, String crashType, String crashAddress,String crashStack, int nativeSiCode, long crashTime);/*** During the crash handling callback, the data returned by this API is displayed in the attachment extraMessage.txt.* @param isNativeCrashed Indicates whether the crash is a native exception.* @param crashType Exception type.* @param crashStack Exception stack.* @param nativeSiCode SI_CODE for the native exception. This data is invalid for non-native exceptions.* @param crashTime Time when the native exception occurs.* @return Reported data.*/String getCrashExtraMessage(boolean isNativeCrashed, String crashType, String crashAddress,String crashStack, int nativeSiCode, long crashTime);/*** This API is executed before the crash handling callback.* @param isNativeCrashed Indicates whether the crash is a native exception.*/void onCrashHandleStart(boolean isNativeCrashed);/*** This API is executed after the crash handling callback.* @param isNativeCrashed Indicates whether the crash is a native exception.* @return The return value has no practical meaning. It does not affect the normal use of this method and can be ignored.*/boolean onCrashHandleEnd(boolean isNativeCrashed);/*** This API is executed during the crash handling callback.* @param isNativeCrashed Indicates whether the crash is a native crash.* @param crashType Crash type.* @param crashMsg Crash message. For example, "Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference" (added in version 4.4.1.2).* @param crashAddress Crash address.* @param crashStack Crash stack.* @param nativeSiCode SI_CODE. This is valid for native exceptions.* @param crashTime Crash time.* @param userId User ID at the time of the crash.* @param deviceId Device ID at the time of the crash.* @param crashUuid Unique identifier for this exception.* @return The return value has no practical meaning. It does not affect the normal use of this method and can be ignored.*/boolean onCrashSaving(boolean isNativeCrashed, String crashType, String crashMsg, String crashAddress,String crashStack, int nativeSiCode, long crashTime, String userId, String deviceId,String crashUuid, String processName);}
CrashHandleListener crashHandleListener = xxx;buglyBuilder.setCrashHandleListener(crashHandleListener);
public interface UploadHandleListener {/*** Callback triggered when the reporting starts.* int TYPE_JAVA_CRASH = 0; // Java crash.* int TYPE_NATIVE_CRASH = 1; // Native crash.* int TYPE_JAVA_CATCHED = 2; // Java error reporting.* int TYPE_ANR_CRASH = 3; // Application Not Responding (ANR).* int TYPE_U3D_CRASH = 4; // U3D error reporting.* @param requestKey Reporting keyword (starting from version 4.4.3.4, this field indicates the type of the reported exception case; valid values are shown above).*/public void onUploadStart(int requestKey);/*** Callback triggered after the reporting ends.* int TYPE_JAVA_CRASH = 0; // Java crash.* int TYPE_NATIVE_CRASH = 1; // Native crash.* int TYPE_JAVA_CATCHED = 2; // Java error reporting.* int TYPE_ANR_CRASH = 3; // ANR.* int TYPE_U3D_CRASH = 4; // U3D error reporting.* @param requestKey Reporting keyword (starting from version 4.4.3.4, this field indicates the type of the reported exception case; valid values are shown above).* @param responseKey Keyword of the response packet.* @param sended Byte stream sent.* @param recevied Byte stream received.* @param result True indicates successful reporting. False indicates failure.* @param exMsg Additional information.*/public void onUploadEnd(int requestKey, int responseKey, long sended, long recevied, boolean result, String exMsg);}
UploadHandleListener uploadHandleListener = null;buglyBuilder.setUploadHandleListener(uploadHandleListener);
/*** Updates the device ID (after initialization).* @param context Context.* @param deviceId Device ID.*/public static void updateUniqueId(Context context, String deviceId);
/*** Updates the user ID (after initialization).* @param context Context.* @param userId User ID.*/public static void updateUserId(Context context, String userId);
/*** Updates the device model (after initialization).* @param context Context.* @param model Device model.*/public static void updateDeviceModel(Context context, String model);
/*** Updates the log level (after initialization).* @param logLevel Log level, which can be obtained from BuglyLogLevel.*/public static void updateLogLevel(int logLevel);
/*** Reports a custom exception.* @param thread Thread where the error occurs. The default value is the current thread.* @param category Exception type. U3D C# : 4 | JavaScript : 8 | Cocos2d Lua : 6.* @param errorType Error type.* @param errorMsg Error message.* @param stack Error stack.* @param extraInfo Additional information.*/public static void postException(Thread thread, int category, String errorType, String errorMsg,String stack, Map<String, String> extraInfo);public static void postException(int category, String errorType, String errorMsg,String stack, Map<String, String> extraInfo);
/*** Handles and reports a caught exception.* @param thread Thread where the error occurs.* @param exception Exception.* @param extraMsg Additional information.* @param extraData Additional data.* @param enableAllThreadStack Specifies whether to enable stack trace capturing for all threads. This is enabled by default.* @return Reporting result.*/public static boolean handleCatchException(Thread thread, Throwable exception, String extraMsg,byte[] extraData, boolean enableAllThreadStack);public static boolean handleCatchException(Thread thread, Throwable exception, String extraMsg,byte[] extraData);
/*** This is not thread-safe. It is recommended to switch to the same thread for this operation.* Configures case tags using the tag IDs in the RUM Pro console.* 1. First, add a tag in the RUM Pro console to obtain the tag ID.* 2. Configure the tag ID using setCaseLabels. To configure multiple tags, separate them with a vertical bar (|).* 3. These tag IDs are reported along with the exception case.* Example: "123|456|789".* SDK version: 4.3.2.9+* @param labels Case tags.*/public static void setCaseLabels(String labels);
/*** This is not thread-safe. It is recommended to switch to the same thread for this operation.* Configures business drill-down tags. To configure multiple tags, separate them with a vertical bar (|).* A maximum of 30 tags can be configured. If more than 30 tags are specified, only the first 30 tags are used.* Each tag cannot exceed 1024 characters in length. Tags longer than this limit cannot be added successfully.* Example: "test_one|test_two|test_three".* SDK version: 4.4.1+* @param labels Business drill-down tags.*/public static void setTestLabels(String labels);
/*** Configures a suspected object for Java memory leaks.* @param leakObj Suspected object.*/public static void startInspectLeakObj(Object leakObj);
/*** Crash testing.* @param crashType Crash type. Valid values: Bugly.JAVA_CRASH, Bugly.NATIVE_CRASH, and Bugly.ANR_CRASH.*/public static void testCrash(@CrashTypeKey int crashType);
public class BuglyCustomLog {public static void v(String tag, String msg) {BuglyLog.v(tag, msg);}public static void d(String tag, String msg) {BuglyLog.d(tag, msg);}public static void i(String tag, String msg) {BuglyLog.i(tag, msg);}public static void w(String tag, String msg) {BuglyLog.w(tag, msg);}public static void e(String tag, String msg) {BuglyLog.e(tag, msg);}public static void e(String tag, String msg, Throwable throwable) {BuglyLog.e(tag, msg, throwable);}/*** Configures the log cache size. Logs are written in a loop based on the configured cache size.* @param size Log cache size.*/public static void setCache(int size) {BuglyLog.setCache(size);}}
BuglyLog.zip in the attachment./*** Adds custom data.* @param context context* @param key key* @param value value*/public static void putUserData(Context context, String key, String value);
/*** Removes custom data.* @param key key* @return If the data exists, the value for the key is returned.*/public static String removeUserData(Context context, String key);
/*** Configures or updates the custom file path array.* @param files File path array. A maximum of 10 files is allowed. The compressed size cannot exceed 10 MB.* @return Configuration result.*/public static boolean setAdditionalAttachmentPaths(String[] files);
/*** Activates a custom scenario.* @param sceneName Scenario name.*/public static void enterScene(String sceneName);/*** Deactivates a custom scenario.* @param sceneName Scenario name.*/public static void exitScene(String sceneName);
Bugly.getGlobalCustomDataEditor to set custom dimensions, or use metric callbacks (ICustomDataCollector) or issue callbacks (ICustomDataCollectorForIssue) to configure or update custom dimensions.ICustomDataCollectorForIssue./*** Obtains the global custom dimension setting API.* @return Global custom dimension setting class.*/public static ICustomDataEditor getGlobalCustomDataEditor();// Configuration exampleICustomDataEditor customDataEditor = Bugly.getGlobalCustomDataEditor();customDataEditor.putStringParam(ICustomDataEditor.STRING_PARAM_1, getAppStateDesc());customDataEditor.putNumberParam(ICustomDataEditor.NUMBER_PARAM_1, Debug.getPss());
// Adds a callback. Metric callbacks and issue callbacks need to be configured separately.Bugly.addCustomDataCollector(customDataEditor);// Removes a callback. Metric callbacks and issue callbacks need to be removed separately.Bugly.removeCustomDataCollector(customDataDditor);
ICustomDataCollector. For example, lag metric and memory peak callbacks are metric callbacks. These callbacks are triggered before information collection and data caching, allowing the application to add additional information if needed./*** Configures a metric data callback. Multiple callbacks can be configured for different monitoring items and scenarios.* @param dataCollector Global custom data callback class.*/public static void addCustomDataCollector(ICustomDataCollector dataCollector);/*** Removes a global custom data callback.* @param dataCollector Global custom data callback class.*/public static void removeCustomDataCollector(ICustomDataCollector dataCollector);// Configuration exampleICustomDataEditor customDataEditor = new ICustomDataCollector() {@Overridepublic void collectCustomData(String pluginName, String scene, ICustomDataEditor customDataEditor) {customDataEditor.putStringParam(ICustomDataEditor.STRING_PARAM_1, getAppStateDesc());customDataEditor.putNumberParam(ICustomDataEditor.NUMBER_PARAM_1, Debug.getPss());}};// Configures the metric callback.Bugly.addCustomDataCollector(customDataEditor);// Removes the metric callback.Bugly.removeCustomDataCollector(customDataDditor);
ICustomDataCollectorForIssue. For example, lag monitoring, Java memory leak, and large image analysis callbacks are issue callbacks. These callbacks are triggered when abnormal issues are detected, allowing you to add additional information if needed./*** Configures a single-metric issue custom data callback. Multiple callbacks can be configured for different monitoring items and scenarios.* @param issueDataCollector Single-metric issue custom data callback class.*/public static void addCustomDataCollector(ICustomDataCollectorForIssue issueDataCollector);/*** Removes a single-metric issue custom data callback.* @param issueDataCollector Single-metric issue custom data callback class.*/public static void removeCustomDataCollector(ICustomDataCollectorForIssue issueDataCollector);// Configuration exampleICustomDataCollectorForIssue issueDataCollector = new ICustomDataCollectorForIssue() {@Overridepublic void collectCustomData(String pluginName, String scene, ICustomDataEditorForIssue customDataEditor) {// Allows overriding global custom dimension settings.customDataEditor.putStringParam(ICustomDataEditor.STRING_PARAM_1, getAppStateDesc());customDataEditor.putNumberParam(ICustomDataEditor.NUMBER_PARAM_1, Debug.getPss());}}// Configures the issue callback.Bugly.addCustomDataCollector(issueDataCollector);// Removes the issue callback.Bugly.removeCustomDataCollector(issueDataCollector);
/*** Dynamic switch for crash monitoring.* @param crashType Crash type. Valid values: Bugly.JAVA_CRASH, Bugly.NATIVE_CRASH, and Bugly.ANR_CRASH.* @param isAble Set to true to enable monitoring, or false to disable monitoring.*/public static void setCrashMonitorAble(@CrashTypeKey int crashType, boolean isAble);/*** Dynamic switch for performance monitoring (enable or disable a group of monitoring items).* @param monitorList List of monitoring items, which can be obtained from BuglyMonitorName.* @param isAble Set to true to enable monitoring, or false to disable monitoring.*/public static void setPerformanceMonitorsAble(List<String> monitorList, boolean isAble);/*** Dynamic switch for performance monitoring (enable or disable a single monitoring item).* @param monitorName Monitoring item.* @param isAble Set to true to enable monitoring, or false to disable monitoring.*/public static void setPerformanceMonitorAble(String monitorName, boolean isAble);/*** Disables all performance monitoring items.*/public static void abolishPerformanceMonitors();
reportAppFullLaunch API to specify a custom startup completion point in the application. Additionally, AppLaunch provides APIs for adding custom tags and custom tracking spans.AppLaunch appLaunch = AppLaunchProxy.getAppLaunch();appLaunch.reportAppFullLaunch();
AppLaunch appLaunch = AppLaunchProxy.getAppLaunch();appLaunch.addTag("show_splash");
AppLaunch appLaunch = AppLaunchProxy.getAppLaunch();appLaunch.spanStart("login", null); // Login task begins.....appLaunch.spanStart("verification_code", "login"); // Verification code task begins.....appLaunch.spanEnd("verification_code"); // Verification code task ends.....appLaunch.spanEnd("login"); // Login task ends.
public interface AppLaunch {/*** Starts startup monitoring.* @param context Context*/void install(Context context);/*** Adds a custom tag.* @param tag Custom tag.*/void addTag(String tag);/*** Starts a tracking span.* @param spanName Name of the tracking span to be started.* @param parentSpanName Name of the parent span for the current tracking span.*/void spanStart(String spanName, String parentSpanName);/*** Ends a tracking span.* @param spanName Name of the tracking span to be ended.*/void spanEnd(String spanName);/*** Marks startup completion.*/void reportAppFullLaunch();}
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback