com.tencent.bugly.Bugly Java Examples

The following examples show how to use com.tencent.bugly.Bugly. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseApplication.java    From shinny-futures-android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * date: 2019/6/18
 * author: chenli
 * description: 配置bugly
 */
private void initBugly(String BUGLY_KEY){
    CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(sContext);
    strategy.setCrashHandleCallback(new CrashReport.CrashHandleCallback() {
        public Map<String, String> onCrashHandleStart(int crashType, String errorType,
                                                      String errorMessage, String errorStack) {
            JSONObject jsonObject = new JSONObject();
            try {
                jsonObject.put(AMP_EVENT_CRASH_TYPE, crashType);
                jsonObject.put(AMP_EVENT_ERROR_TYPE, errorType);
                jsonObject.put(AMP_EVENT_ERROR_MESSAGE, errorMessage);
                jsonObject.put(AMP_EVENT_ERROR_STACK, errorStack);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            Amplitude.getInstance().logEventWrap(AMP_CRASH, jsonObject);
            LinkedHashMap<String, String> map = new LinkedHashMap<>();
            map.put("user-agent", sDataManager.USER_AGENT);
            return map;
        }
    });
    Beta.enableHotfix = false;
    Bugly.init(sContext, BUGLY_KEY, false, strategy);
}
 
Example #2
Source File: App.java    From guanggoo-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    sInstance = this;

    if (ConfigUtil.isDebug() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectNonSdkApiUsage()
                .penaltyLog()
                .build());
    }

    mGlobal = new GlobalData();

    Bugly.init(getApplicationContext(), "6ace1b5b58", false);
}
 
Example #3
Source File: AppApplication.java    From OpenHub with GNU General Public License v3.0 6 votes vote down vote up
private void initBugly(){

        Beta.initDelay = 6 * 1000;
        Beta.enableHotfix = false;
        Beta.canShowUpgradeActs.add(LoginActivity.class);
        Beta.canShowUpgradeActs.add(MainActivity.class);
        Beta.canShowUpgradeActs.add(AboutActivity.class);
        Beta.upgradeListener = UpgradeDialog.INSTANCE;

        CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(getApplicationContext());
        strategy.setAppVersion(BuildConfig.VERSION_NAME);
        strategy.setAppChannel(getAppChannel());
        strategy.setAppReportDelay(10 * 1000);
        Bugly.init(getApplicationContext(), AppConfig.BUGLY_APPID, BuildConfig.DEBUG, strategy);
        CrashReport.setIsDevelopmentDevice(getApplicationContext(), BuildConfig.DEBUG);

    }
 
Example #4
Source File: PlayerApplication.java    From KSYMediaPlayer_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    Bugly.init(getApplicationContext(), "fa7327d922", true);
    Bugly.setAppChannel(getApplicationContext(), "public");

    // 初始化金山云的Android硬解白名单功能, 此功能需与金山云服务器通信,建议尽早调用
    // 若不想使用该功能,请勿调用此接口
    KSYHardwareDecodeWhiteList.getInstance().init(this);
}
 
Example #5
Source File: SysApplication.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    initProxy();
    // Gradle automatically generates proper variable as below.
    UploadService.NAMESPACE = BuildConfig.APPLICATION_ID;

    Bugly.init(getApplicationContext(), "db9f598223", false);
}
 
Example #6
Source File: HHApplication.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化腾讯bugly
 */
private void initBugly() {
    Beta.largeIconId = R.mipmap.ic_launcher;
    Beta.smallIconId = R.mipmap.ic_launcher;
    //设置SD卡中的Download为默认的更新目录
    Beta.storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
    Bugly.init(getApplicationContext(), "e436df84f4", org.huxizhijian.sdk.util.Utils.isApkDebugable(this));
}
 
Example #7
Source File: DoingDailyMainInit.java    From DoingDaily with Apache License 2.0 5 votes vote down vote up
private void initBugly() {
    Beta.autoInit = true;
    Beta.autoCheckUpgrade = true;
    Beta.showInterruptedStrategy = true;
    Beta.initDelay = 8 * 1000;
    Beta.canShowUpgradeActs.add(MainActivity.class);
    Beta.smallIconId = R.drawable.ic_notification_logo;
    Bugly.init(appContext, ConstantValues.BUGLY_ID, BuildConfig.DEBUG);
    //CrashReport.testJavaCrash();
}
 
Example #8
Source File: SnakeApplication.java    From Snake with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Snake.setDebug(BuildConfig.DEBUG);
    Snake.init(this);
    Bugly.init(this, Constant.BUGLY_APP_ID, BuildConfig.DEBUG);
}
 
Example #9
Source File: GravityBoxApplication.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private void initBugly() {
    Beta.upgradeCheckPeriod = 60 * 1000 * 60 * 12;
    Beta.initDelay = 1000;
    Beta.showInterruptedStrategy = true;
    Beta.enableHotfix = false;
    Bugly.init(getApplicationContext(), "375cce688e", BuildConfig.DEBUG);
}
 
Example #10
Source File: BaseApplication.java    From AccountBook with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 初始化 Bugly
 */
private void initCrashReport() {
    try {
        ApplicationInfo appInfo = getPackageManager().getApplicationInfo(getPackageName(),
                PackageManager.GET_META_DATA);
        String appId = appInfo.metaData.getString("BUGLY_APPID");
        Bugly.init(getContext(), appId, BuildConfig.DEBUG);
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }
}
 
Example #11
Source File: App.java    From FakeWeather with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    mContext = getApplicationContext();
    LitePal.initialize(this);
    if (!BuildConfig.DEBUG) {
        AppExceptionHandler.getInstance().setCrashHanler(this);
    }
    Bugly.init(getApplicationContext(), "914abea303", false);
}
 
Example #12
Source File: MyApplication.java    From music_player with Open Software License 3.0 5 votes vote down vote up
private void initialBugly() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Context context = getApplicationContext();
            String packageName = context.getPackageName();
            String processName = getProcessName(android.os.Process.myPid());
            CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
            strategy.setUploadProcess(processName == null || processName.equals(packageName));
            Beta.initDelay = 3000;
            Bugly.init(context, "1d65abe1b1", false);

        }
    }).start();
}
 
Example #13
Source File: ReadhubApplicationLike.java    From JReadHub with GNU General Public License v3.0 5 votes vote down vote up
private void initBugly() {
    String packageName = getApplication().getPackageName();
    String processName = getProcessName(android.os.Process.myPid());
    CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(getApplication());
    strategy.setUploadProcess(processName == null || processName.equals(packageName));

    Beta.storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
    Beta.autoCheckUpgrade = false;
    Beta.canShowUpgradeActs.add(MainActivity.class);
    String channel = WalleChannelReader.getChannel(getApplication());
    strategy.setAppChannel(channel);
    Bugly.init(getApplication(), "c16799f8bc", false, strategy);
}
 
Example #14
Source File: MyApplication.java    From Pic2Ascii with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    // 这里实现SDK初始化,appId替换成你的在Bugly平台申请的appId
    // 调试时,将第三个参数改为true
    Bugly.init(this, "38e029a0d2", true);
}
 
Example #15
Source File: AcgClubLike.java    From AcgClub with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();
  mCommonApplicationLike.onCreate();

  boolean defaultProcess = SystemUtils.getCurProcessName()
      .equals(getApplication().getPackageName());

  //获取渠道包值
  String channel = ChannelReaderUtil.getChannel(getApplication());
  if (!TextUtils.isEmpty(channel)) {
    mChannel = channel;
  }

  //bugly
  BuglyStrategy strategy = new BuglyStrategy();
  strategy.setAppChannel(mChannel);
  strategy.setAppPackageName(BuildConfig.APPLICATION_ID);
  strategy.setAppVersion(BuildConfig.VERSION_NAME);
  strategy.setUploadProcess(defaultProcess);
  Bugly.init(getApplication(), BuildConfig.BUGLY_APP_ID, BuildConfig.APP_DEBUG, strategy);
  Bugly.setIsDevelopmentDevice(getApplication(), BuildConfig.APP_DEBUG);

  if (defaultProcess) {
    mCommonApplicationLike.onDefaultProcessCreate();
    onDefaultProcessCreate();
  }
}
 
Example #16
Source File: AndroidPlusApp.java    From AndroidPlusJava with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    //Init Lean Cloud
    initSubClasses();
    AVOSCloud.initialize(this, APP_ID, APP_KEY);
    AVOSCloud.setDebugLogEnabled(BuildConfig.DEBUG);

    EventBus.builder().addIndex(new MyEventBusIndex()).installDefaultEventBus();

    Beta.enableHotfix = false;
    Beta.autoDownloadOnWifi = true;
    Bugly.init(getApplicationContext(), "033d44667d", BuildConfig.DEBUG);
}
 
Example #17
Source File: IApplication.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
public void onCreate() {
    super.onCreate();
    _context = this.getApplicationContext();
    _asset = _context.getAssets();

    //AndroidUtilsCode
    Utils.init(this);

    //skins
    SkinCompatManager.withoutActivity(this)                         // 基础控件换肤初始化
            .addInflater(new SkinMaterialViewInflater())            // material design 控件换肤初始化[可选]
            .addInflater(new SkinConstraintViewInflater())          // ConstraintLayout 控件换肤初始化[可选]
            .addInflater(new SkinCardViewInflater())                // CardView v7 控件换肤初始化[可选]
            .addInflater(new SkinFlycoTabLayoutInflater())
            .setSkinStatusBarColorEnable(true)                      // 关闭状态栏换肤,默认打开[可选]
            .setSkinWindowBackgroundEnable(true)                    // 关闭windowBackground换肤,默认打开[可选]
            .setSkinAllActivityEnable(true)
            .loadSkin();

    //Crash
    CaocConfig.Builder.create()
            .backgroundMode(CaocConfig.BACKGROUND_MODE_SHOW_CUSTOM)
            .enabled(true)
            .trackActivities(true)
            .minTimeBetweenCrashesMs(2000)
            .restartActivity(SplashActivity.class)
            .errorActivity(CrashActivity.class)
            .apply();

    //Bugly
    Bugly.init(getApplicationContext(), SoUtils.getInstance().getBuglyAppId(), false);

    //Sophix
    SophixManager.getInstance().setPatchLoadStatusStub(CommonUtils.getPatchLoadListener());

    //thunder
    XLTaskHelper.init(this);

    //数据库
    DataBaseManager.init(this);

    //播放器配置
    PlayerConfigShare.initPlayerConfigShare(this);

    //检查补丁
    if (AppConfig.getInstance().isAutoQueryPatch()){
        SophixManager.getInstance().queryAndLoadNewPatch();
    }

    startCorrectlyFlag = true;

    //严格模式
    //strictMode();
}
 
Example #18
Source File: BuglyAgentHelper.java    From xamarin-bugly with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static void init(Context context,String appId){
    Bugly.init(context,appId,false);
}