Android 腾讯bugly监听奔溃信息

接入网站

Android 腾讯bugly监听奔溃信息_第1张图片

 implementation 'com.tencent.bugly:crashreport:latest.release'

同意隐私协议后初始化

    //初始化bugly
    private void initBugly(){
        // 创建UserStrategy对象
        CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(this);
        // 设置应用渠道
        strategy.setAppChannel(PackageUtil.getUmengChannelName(this)); // 替换为实际的渠道名称

        // 设置设备名称
        strategy.setDeviceModel(Build.MANUFACTURER + " " + Build.MODEL); // 例如:"Samsung SM-G998B"

        // 初始化Bugly
        CrashReport.initCrashReport(getApplicationContext(),
                Global.buglyAppId, // App ID
                false, // 是否开启调试模式
                strategy); // 用户自定义策略
    }

你可能感兴趣的:(安卓原生学习,android)