Small library that allows the application to display a small troubleshooting guide in case of repeated app startup crashes.

Overview

License

AppSalvager

What is it?

AppSalvager allows you to combat the issue of repeating crashes on app startup. Failed data migration, SDKs not handling their errors correctly, corrupted data...there are many reasons why this can happen.

Quick start

  1. Add implementation 'io.github.drbreen:appsalvager:0.1.0' to your module dependencies.
  2. Override attachBaseContext(Context) in your Application object.
  3. Call AppSalvager.install(AppSalvager.Config) there.
  4. Override Application.onCreate(), and right after calling super.onCreate, check boolean flag AppSalvager.inSalvageMode. If this flag is true, then you should abort normal onCreate flow and return as early as possible (ideally, right after the check). Not following that can lead to salvage mode itself crashing.

Configuration

AppSalvager.Config contains following fields:

  • policy is an object implementing SalvageModePolicy interface. This object will determine if exceptions history should trigger salvage mode. You can use one of the default policies, which will be listed shortly.

  • createSalvageView - factory method to set up View for salvage mode screen. The view and factory method should be as simple as possible to minimize the risk of crashes. For example, it could be a text with illustration instructing customer to delete and reinstall the app or clear app data. Or, as in the example, it could be something that cleans SharedPreferences.

  • uptimeThreshold - timeframe in milliseconds that determine whether exception will be regarded as "occurred during startup". Any exception occurring after the threshold will be ignored by AppSalvager.

  • allowedExceptionRecency - interval in milliseconds that determine if exception is taken into consideration when evaluation the policy. If exception is older than this interval, then it's going to be discarded.

Available salvage mode policies

  • ExceptionNumberPolicy - if recent exceptions number exceed a certain threshold (3 by default), salvage mode will be triggered.

  • SameExceptionPolicy - if recent exception is the same, salvage mode will be triggered. SameExceptionPolicy.Configuration can be used to fine tune comparison parameters.

  • CompositeSalvageModePolicy - wrapper that checks several policies, and triggers salvage mode if all the policies agreed to trigger it.

Reporting fixed problem in salvage mode

If you have some specific steps inside your salvaging mode that should fix your problems, you can clean exception history by calling AppSalvager.resetExceptions. This is an optional step - if on next startup app did not have any exceptions in uptimeThreshold timeframe since startup, then this method is going to be called automatically.

Limitations

Repeated java.lang.Errors are not processed. JVM errors may lead to undefined behavior if code execution is continued after an error.

Integration with Crashlytics/other automatic exception reporting frameworks

AppSalvage sets its' exception handler as default exception handler, so all the crash reporting frameworks should work out of the box. If there are cases where AppSalvage does not work, please open an issue.

Pull requests

As of now, there is no defined policy on code style or pull request content, so it's basically free for all :) I'll be very happy to see what you want to improve in the library.

License

Apache 2.0 license is used. See LICENSE file for details.

You might also like...
An android app which allows users to display the data of any excel sheet in rows and columns
An android app which allows users to display the data of any excel sheet in rows and columns

ExcelReader App description An android app which allows users to display the data of any excel sheet in rows and columns. Features Display data of an

AppUI Sample Application - display how you can create your own custom AppUI application within a few minutes
AppUI Sample Application - display how you can create your own custom AppUI application within a few minutes

AppUI Sample Application This is an open-source project to display how you can create your own custom AppUI application within a few minutes. I have a

A mobile application that allows you to get random information every time you enter the application.
A mobile application that allows you to get random information every time you enter the application.

Knowledge Repository A mobile application that allows you to get random information every time you enter the application. Google Play Store : Screensh

RedditNews - A simple application to display the top news from the Reddit API site and save your favorites to a local database.
RedditNews - A simple application to display the top news from the Reddit API site and save your favorites to a local database.

RedditNews - A simple application to display the top news from the Reddit API site and save your favorites to a local database. Arch

Simple android application that consumes RAWG API to display a list of games
Simple android application that consumes RAWG API to display a list of games

Gamex Compose -Work in Progress- An android application that consumes RAWG API to display a list of popular video games built using Jetpack Compose an

Marvel - A simple application to display information about the characters of the Marvel universe
Marvel - A simple application to display information about the characters of the Marvel universe

Marvel Characters 'Marvel characters' is a simple application to display informa

Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.
Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.

Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.

Acme-app - App to display the best routes for drivers based on a secret algorithm

Acme App App to display the best routes for drivers based on a "secret" algorith

Todo List Application is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item
Todo List Application is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item

Todo List Application is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item

Releases(0.1.0)
Owner
Alexander Leontev
Android/iOS developer
Alexander Leontev
Application that allows to search some products and display them in a list, also allows to add some product to the shopping cart and remove it

Application that allows to search some products and display them in a list, also allows to add some product to the shopping cart and remove it

Victor 3 Aug 18, 2022
Instrumentation library for Android Cold Startup

This is an instrumentation library for Android Cold Startup which gives duration for each phase of App Startup.

OkCredit 39 Dec 26, 2022
The Android startup used to schedule tasks, jobs while launching Android App.

Android Startup, schedule your startup jobs Introduction AndroidStartup is an open source project used to refine your Andriod App startup. Compared wi

ShouHeng 46 Aug 24, 2022
See a pretty error screen when your Android app crashes

WhatTheStack WhatTheStack is a library to make your debugging experience on Android better. It shows you a pretty error screen when your Android App c

Kshitij Chauhan 241 Nov 11, 2022
Test android startup time fluctsdk

Test android startup time fluctsdk

Shuma Yoshioka 0 Feb 4, 2022
A simple app to show case Master detail application for Movies

Decade of Movies App Demo Application to understand the architecture of MVVM App with Unit tests Build Instructions The gradle build system will fetch

Muhammad Nouman 27 Dec 24, 2021
Mole Analysis Use Case for HMS ML Kit Custom Model

Mole Analysis Mole Analysis Use Case for HMS ML Kit Custom Model Introduction What is Melanoma? Melanoma is the most serious among skin cancers becaus

null 15 Aug 23, 2022
Travel Guide App - FMSS Kotlin Bootcamp

Travel-Guide-Capstone-Project Travel Guide App - FMSS Kotlin Bootcamp ?? Table of Contents About The Project Pages About The Project Travel Guide App

ozturksahinyetisir 1 Oct 12, 2022
Display's information about SpaceX crew members and ships by consuming a rest api and storing the data to display when the user is offline.

Space-X App Display's information about SpaceX crew members(look for ‘Crew’ section in rest api docs) and ships (look for ‘Ships’ section in rest api

krishna chaitanya 2 Apr 8, 2022
Dagger Hilt Tutorial - Step by Step Guide

Dagger Hilt Tutorial - Step by Step Guide This repository contains a sample app that implements Dagger-Hilt in MVVM architecture using Kotlin. The app

null 3 Nov 26, 2021