# HuaweiService.crash
#### Scenario:
| Description | Api | Reference |
---|---|---
Enables or disables the crash data reporting function. If the function is disabled, the Crash service does not collect or report crash data. The function is enabled by default.
``收集崩溃报告开关``|enableCrashCollection(boolean enable)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Triggers a crash.
``测试崩溃实现``|testIt()|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Sets a custom user ID.
``自定义用户标识``|setUserId(String userId)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Sets the key and value for a custom key-value pair
``自定义键值对``|setCustomKey(String key, String value)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Sets the key and value for a custom key-value pair
``自定义键值对``|setCustomKey(String key, boolean value)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Sets the key and value for a custom key-value pair
``自定义键值对``|setCustomKey(String key, double value)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Sets the key and value for a custom key-value pair
``自定义键值对``|setCustomKey(String key, float value)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Sets the key and value for a custom key-value pair
``自定义键值对``|setCustomKey(String key, int value)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Sets the key and value for a custom key-value pair
``自定义键值对``|setCustomKey(String key, long value)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Records a custom log.
``自定义日志级别``|log(String message)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)
Records a custom log.
``自定义日志级别``|log(int level, String message)|[https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectcrash)