我有一个networkStateReceiver,检查我是否有互联网。 如果我这样做,我重新启动instabug,如果没有,我想停用。我怎样才能做到这一点? 我试着将它设置为null,但它不起作用。Instabug,如果没有互联网访问,是否可以停用反馈动态?
if(haveConnectedMobile || haveConnectedWifi){
//TODO will need to make a queue, and go through all that queue
PSLocationCenter.getInstance().initInstabug();
}else{
PSLocationCenter.getInstance().instabug = null;
}
这是我的init:
public void initInstabug() {
String[] feedbackArray = getResources().getStringArray(R.array.feedback);
String randomStr = feedbackArray[new Random().nextInt(feedbackArray.length)];
Instabug.DEBUG = true;
instabug = Instabug.initialize(this)
.setAnnotationActivityClass(InstabugAnnotationActivity.class)
.setShowIntroDialog(true, PSTimelineActivity.class)
.enableEmailField(true, false)
.setEnableOverflowMenuItem(true)
.setDebugEnabled(true)
.setCommentRequired(true)
.setPostFeedbackMessage(randomStr)
.setPostBugReportMessage(randomStr) //TODO will be the post report message, random from array
.setCommentFieldHint("Please describe what went wrong")
.setPreSendingRunnable(new Runnable() {
@Override
public void run() {
String[] files = new String[2];
files[0] = Environment.getExternalStorageDirectory() + "/Passenger/passenger_log.txt";
files[1] = Environment.getExternalStorageDirectory() + "/Passenger/passenger_log2.txt";
Compress compress = new Compress(files, Environment.getExternalStorageDirectory() + "/Passenger/log.zip");
compress.zip(new CrudStateCallback() {
@Override
public void onResponse(String string) {
Log.i("", "ended making the archive");
}
});
}
})
.attachFileAtLocation(Environment.getExternalStorageDirectory() + "/Passenger/log.zip");
}
我试过IBGInvocationEventNone,但没有奏效。当然是因为我没有重新开始这项活动。虽然这不再需要,因为像你说的那样,如果没有互联网,它应该在互联网回来后发送报告。 我在说应该,因为我试过了,在Iphone上,它确实发送了报告,当我激活互联网,在Android上没有。 PS:我正在使用这个版本,所以它应该采取最新的,对吗?: compile'com.instabug.library:instabugsupport:1+' –
对不起,只需再次阅读您的答案。它会尝试发送下一个应用程序启动?这意味着为了发送报告,我需要强制关闭应用程序并重新启动它?为什么不在讨论活动? –
无需强制关闭应用程序。如果您在当前活动中调用onPause然后onResume,SDK将使用新配置重新启动任何侦听器。你可以给我发一封电子邮件给[email protected]关于网络问题吗? –