gpt4 book ai didi

android - Instabug,如果没有互联网访问,是否可以停用摇动以获得反馈?

转载 作者:行者123 更新时间:2023-11-29 20:38:51 24 4
gpt4 key购买 nike

我有一个 networkStateReceiver,它检查我是否有互联网。如果我这样做,我会重新启动 instabug,如果没有,我想停用。我怎样才能做到这一点?我尝试将其设置为 null,但它不起作用。

if(haveConnectedMobile || haveConnectedWifi){
//TODO will need to make a queue, and go through all that queue
PSLocationCenter.getInstance().initInstabug();
}else{
PSLocationCenter.getInstance().instabug = null;
}

这是我的初始化:

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");
}

最佳答案

您可以使用此代码来禁用 Instabug 自动调用:

Instabug.getInstance().setInvocationEvent(IBGInvocationEvent.IBGInvocationEventNone)

这样它就不会被自动调用。这只会影响下一个 Activity (而不是当前 Activity )。您可以通过在当前 Activity 上调用 onPauseonResume 强制停止并重新启动所有监听器。 (不过我们可能会很快解决这个问题,以便将此类更改应用于当前正在运行的 Activity)。

不要忘记在恢复互联网访问时也启用摇动调用事件。

请记住,Instabug SDK 已经缓存了所有报告,并将在下次应用启动时重新尝试发送它们,直到它们成功上传。

关于android - Instabug,如果没有互联网访问,是否可以停用摇动以获得反馈?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31179021/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com