我怎么知道何时调用 InstaBug,以便我可以进行存档



我的应用程序中有一些日志文件,我想用这个日志制作一个zip文件,并通过Instabug发送,当我摇动手机并按"报告错误"或"发送反馈"时。

这是我的应用程序的代码:

  Instabug.initialize(this)
            .setAnnotationActivityClass(InstabugAnnotationActivity.class)
            .setShowIntroDialog(true, PSTimelineActivity.class)
            .enableEmailField(true,false)
            .setEnableOverflowMenuItem(true)
            .setDebugEnabled(true)
            .setBugHeaderText("Error")
            .attachFileAtLocation(Environment.getExternalStorageDirectory() + "/Passenger/log.zip");

如您所见,我选择了应该附加的文件,但我还需要从我的日志文件中制作该文件,就在我摇晃手机之后(因此它将获取最新的日志),在按下 2 个按钮中的任何一个之前报告。我有存档功能,我只是不知道我可以把它放在哪里,所以这可以工作。有什么想法吗?

我像这样初始化了Instabug:

Instabug.initialize(this)
            .setAnnotationActivityClass(InstabugAnnotationActivity.class)
            .setShowIntroDialog(true, PSTimelineActivity.class)
            .enableEmailField(true,false)
            .setEnableOverflowMenuItem(true)
            .setDebugEnabled(true)
            .setBugHeaderText("Error")
            .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");

按照Hassan Ibraheem的建议,现在我在preSendingRunnable中创建.zip。

相关内容

最新更新