Search code examples
androiddialogdelaybuilderinstabug

Can I delay the instabug IntroDialog?


In my Application class I have this method, that I call on the onCreate of my Application:

   public void initInstabug() {
    try {
        instabug =   new Instabug.Builder(this, "45c752889689ac2ae0840d11e2a5f628")
                .setDebugEnabled(true)
                .setEmailFieldRequired(true)
                .setFloatingButtonOffsetFromTop(400)
                .setShouldShowIntroDialog(true)
                .setColorTheme(IBGColorTheme.IBGColorThemeLight)
                .setCommentFieldRequired(true)
                .setInvocationEvent(IBGInvocationEvent.IBGInvocationEventShake)
                .build();
        instabug.setPrimaryColor(getResources().getColor(R.color.background));
        instabug.setPreSendingRunnable(new Runnable() {
            @Override
            public void run() {
                Log.i("","instabug entered pre sending runnable");
                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("", "instabug ended making the archive");
                    }
                });
            }
        });
        File file = new File(Environment.getExternalStorageDirectory() + "/Passenger/log.zip");
        Uri uri = Uri.fromFile(file);
        instabug.setFileAttachment(uri, null);
    }catch (Exception e){
        Log.e("","error instabug:" + e.getMessage());
        Utils.appendLog("In case instabug crashes asyncTask process, will not crash app",true);
    }
}

My Issue is that I have the login page, first, and the popup always comes up while I ussually write my login info (email, password). Is it possible to delay the introDialog, so it will appear only when another activity is open? I tried initialising my instabug instance with this code in Application, where .setShouldShowIntroDialog(FALSE) is set to false, as you can see. And then in the timeline I reinit it with .setShouldShowIntroDialog(true). But it doesn't show at all like this.


Solution

  • You can try to use Instabug.showIntroMessage() in your activity and set the .setShouldShowIntroDialog() to false.