本文整理匯總了Java中com.tencent.bugly.crashreport.CrashReport.UserStrategy方法的典型用法代碼示例。如果您正苦於以下問題:Java CrashReport.UserStrategy方法的具體用法?Java CrashReport.UserStrategy怎麽用?Java CrashReport.UserStrategy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.tencent.bugly.crashreport.CrashReport
的用法示例。
在下文中一共展示了CrashReport.UserStrategy方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.tencent.bugly.crashreport.CrashReport; //導入方法依賴的package包/類
@Override
public void onCreate() {
// boxStore = MyObjectBox.builder().androidContext(this).build();
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));
// 初始化Bugly
Bugly.init(getApplicationContext(), "1d65abe1b1", false);
Beta.initDelay = 1 * 1000;
// Beta.upgradeDialogLayoutId = R.layout.upgrade_dialog;
super.onCreate();
}
示例2: onCreate
import com.tencent.bugly.crashreport.CrashReport; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.build();
ImagePipelineConfig config = OkHttpImagePipelineConfigFactory.newBuilder(this, okHttpClient)
.setMainDiskCacheConfig(getDiskCacheConfig())
.setNetworkFetcher(new OkHttpNetworkFetcher(okHttpClient))
.setDownsampleEnabled(true)
.build();
Fresco.initialize(this, config);
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));
CrashReport.initCrashReport(getApplicationContext(), "0a6e92fb70", false, strategy);
registerActivityLifecycleCallbacks(ActivityLifecycleHelper.build());
}
示例3: initBugly
import com.tencent.bugly.crashreport.CrashReport; //導入方法依賴的package包/類
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.setAppReportDelay(10 * 1000);
Bugly.init(getApplicationContext(), AppConfig.BUGLY_APPID, BuildConfig.DEBUG, strategy);
CrashReport.setIsDevelopmentDevice(getApplicationContext(), BuildConfig.DEBUG);
}
示例4: initBugly
import com.tencent.bugly.crashreport.CrashReport; //導入方法依賴的package包/類
private void initBugly() {
Context context = getApplicationContext();
String packageName = context.getPackageName();
String processName = SystemUtil.getProcessName(android.os.Process.myPid());
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
strategy.setUploadProcess(processName == null || processName.equals(packageName));
CrashReport.initCrashReport(context, Constants.BUGLY_ID, isDebug, strategy);
}
示例5: init
import com.tencent.bugly.crashreport.CrashReport; //導入方法依賴的package包/類
public static void init( Context app) {
// 初始化Bugly
if (!BuildConfig.DEBUG) {
// 獲取當前包名
String packageName = app.getPackageName();
// 獲取當前進程名
String processName = SysUtils.getProcessName(android.os.Process.myPid());
// 設置是否為上報進程
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(app);
strategy.setUploadProcess(processName == null || processName.equals(packageName));
CrashReport.initCrashReport(app.getApplicationContext(),app.getString(R.string.bugly_app_id), false, strategy);
} else {
if (app.getResources().getBoolean(R.bool.crash_logger_enable)) {
Thread.currentThread()
.setUncaughtExceptionHandler(new CrashLogger(getAppContext()));
} else {
try{
CustomActivityOnCrash.install(app);
}catch (Exception e){
Log.e(e,"CrashReportConfig on CustomActivityOnCrash init");
}
}
}
}
示例6: initCrashReport
import com.tencent.bugly.crashreport.CrashReport; //導入方法依賴的package包/類
private void initCrashReport(Context context) {
try {
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
strategy.setAppVersion(UdeskCoreConst.sdkversion + UdeskUtil.getAppName(context));
CrashReport.initCrashReport(context, UdeskCoreConst.buglyAppid, false, strategy);
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: initBugly
import com.tencent.bugly.crashreport.CrashReport; //導入方法依賴的package包/類
/**
* 初始化bugly
*/
private void initBugly() {
// 獲取當前包名
String packageName = mContext.getPackageName();
// 獲取當前進程名
String processName = getProcessName(android.os.Process.myPid());
// 設置是否為上報進程
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(mContext);
strategy.setUploadProcess(processName == null || processName.equals(packageName));
CrashReport.initCrashReport(getApplicationContext(), "7a544c9222", false);
}
示例8: onCreate
import com.tencent.bugly.crashreport.CrashReport; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
instance = this;
appComponent = DaggerAppComponent
.builder()
.applicationModule(new ApplicationModule(this))
.httpModule(new HttpModule())
.build();
// 初始化Bugly
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(getApplicationContext());
strategy.setAppVersion(String.valueOf(AppApplicationUtil.getVersionCode(getApplicationContext())));
CrashReport.initCrashReport(getApplicationContext(), Constants.BUGLY_APP_ID, true); // debug版本設置為true,正式發布設置為false
// 初始化Fragmentation
Fragmentation.builder()
// 設置 棧視圖 模式為 懸浮球模式 SHAKE: 搖一搖喚出 默認NONE:隱藏, 僅在Debug環境生效
.stackViewMode(Fragmentation.BUBBLE)
// 開發環境:true時,遇到異常:"Can not perform this action after onSaveInstanceState!"時,拋出,並Crash;
// 生產環境:false時,不拋出,不會Crash,會捕獲,可以在handleException()裏監聽到
.debug(true)
// 實際場景建議.debug(BuildConfig.DEBUG)
// 生產環境時,捕獲上述異常(避免crash),會捕獲
// 建議在回調處上傳下麵異常到崩潰監控服務器
.handleException(new ExceptionHandler() {
@Override
public void onException(Exception e) {
CrashReport.postCatchedException(e); // bugly會將這個Exception上報
}
})
.install();
// 初始化LeakCanary
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
LeakCanary.install(this);
}