Write to crash report file if app is unable to open

This commit is contained in:
ByteHamster 2020-11-20 12:11:24 +01:00
parent 4b252250c0
commit 045790eaa1
1 changed files with 9 additions and 7 deletions

View File

@ -13,9 +13,9 @@ import android.widget.ProgressBar;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.error.CrashReportWriter;
import io.reactivex.Completable; import io.reactivex.Completable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
/** /**
@ -44,13 +44,15 @@ public class SplashActivity extends AppCompatActivity {
}) })
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(() -> { .subscribe(
Intent intent = new Intent(SplashActivity.this, MainActivity.class); () -> {
startActivity(intent); Intent intent = new Intent(SplashActivity.this, MainActivity.class);
overridePendingTransition(0, 0); startActivity(intent);
finish(); overridePendingTransition(0, 0);
}, error -> { finish();
}, error -> {
error.printStackTrace(); error.printStackTrace();
CrashReportWriter.write(error);
Toast.makeText(this, error.getLocalizedMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(this, error.getLocalizedMessage(), Toast.LENGTH_LONG).show();
finish(); finish();
}); });