Recovery

a crash recovery framework.(一个App异常恢复框架)

APACHE-2.0 License

Stars
1.7K

Recovery

A crash recovery framework!


Introduce

RecoveryCrash

  • Activity Stack
  • Activity
  • Crash

Art

Usage

Reference

Gradle

	implementation 'com.zxy.android:recovery:1.0.0'
    debugImplementation 'com.zxy.android:recovery:1.0.0'
    releaseImplementation 'com.zxy.android:recovery-no-op:1.0.0'

Maven

		<dependency>
  			<groupId>com.zxy.android</groupId>
  			<artifactId>recovery</artifactId>
  			<version>1.0.0</version>
  			<type>pom</type>
		</dependency>

Init

Application

        Recovery.getInstance()
                .debug(true)
                .recoverInBackground(false)
                .recoverStack(true)
                .mainPage(MainActivity.class)
                .recoverEnabled(true)
                .callback(new MyCrashCallback())
                .silent(false, Recovery.SilentMode.RECOVER_ACTIVITY_STACK)
                .skip(TestActivity.class)
                .init(this);

CrashRecoveryActivityApplication

        Recovery.getInstance()
                .debug(true)
                .recoverInBackground(false)
                .recoverStack(true)
                .mainPage(MainActivity.class)
                .recoverEnabled(true)
                .callback(new MyCrashCallback())
                .silent(false, Recovery.SilentMode.RECOVER_ACTIVITY_STACK)
                .skip(TestActivity.class)
                .init(this);

RecoveryActivitydebugrecoverEnabled(false);

Arguments

Argument Type Function
debug boolean debug
recoverInBackgroud boolean Crash
recoverStack boolean Activity StackActivity
mainPage Class<? extends Activity>
callback RecoveryCallback Crash
silent boolean,SilentMode trueCrashRecoveryActivityActivity

SilentMode

  1. RESTART -
  2. RECOVER_ACTIVITY_STACK - Activity
  3. RECOVER_TOP_ACTIVITY - Activity
  4. RESTART_AND_CLEAR -

Callback

public interface RecoveryCallback {

    void stackTrace(String stackTrace);

    void cause(String cause);

    void exception(String throwExceptionType, String throwClassName, String throwMethodName, int throwLineNumber);
    
    void throwable(Throwable throwable);
}

Custom Theme

RecoveryActivitystyles

    <color name="recovery_colorPrimary">#2E2E36</color>
    <color name="recovery_colorPrimaryDark">#2E2E36</color>
    <color name="recovery_colorAccent">#BDBDBD</color>
    <color name="recovery_background">#3C4350</color>
    <color name="recovery_textColor">#FFFFFF</color>
    <color name="recovery_textColor_sub">#C6C6C6</color>

Crash File Path

{SDCard Dir}/Android/data/{packageName}/files/recovery_crash/

Update history

  • VERSION-0.0.5****
  • VERSION-0.0.6****
  • VERSION-0.0.7****
  • VERSION-0.0.8Activity,:skip()
  • VERSION-0.0.9UI
  • VERSION-0.1.0,Recovery,
  • VERSION-0.1.3no-op
  • VERSION-0.1.4.
  • VERSION-0.1.5fix 8.0+ hook bug
  • VERSION-0.1.6update
  • VERSION-1.0.08.0

About

LICENSE

   Copyright 2016 zhengxiaoyong

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
Badges
Extracted from project README
Related Projects