A crash recovery framework!
“Recovery” can help you to automatic processing app crash at run time.It provides the following functions
- Automatic recovery activity stack and data.
- Support to recover the top activity
- To view and save of crash info.
- Restart and clear the cache.
- Twice failed to recover in a minute, will no longer to recover but to restart
Gradle
compile 'com.zxy.android:recovery:0.0.2'
Maven
<dependency>
<groupId>com.zxy.android</groupId>
<artifactId>recovery</artifactId>
<version>0.0.2</version>
<type>pom</type>
</dependency>
In a custom Application performs initialization
Recovery.getInstance()
.debug(true)
.recoverInBackground(false)
.recoverStack(true)
.mainPage(MainActivity.class)
.callback(new MyCrashCallback())
.init(this);
Argument | Type | Function |
---|---|---|
debug | boolean | Whether to open the debug mode |
recoverInBackgroud | boolean | When the App in the background, whether to restore the stack |
recoverStack | boolean | Whether to restore the activity stack,else to restore the top activity |
mainPage | Class<? extends Activity> | The back page |
callback | RecoveryCallback | Crash info callback |
public interface RecoveryCallback {
void stackTrace(String stackTrace);
void cause(String cause);
void exception(String throwExceptionType, String throwClassName, String throwMethodName, int throwLineNumber);
}
Rewrite in your styles file:
<color name="recoveryColorPrimary">#F44336</color>
<color name="recoveryColorPrimaryDark">#D32F2F</color>
<color name="recoveryColorAccent">#BDBDBD</color>
<color name="recoveryTextColor">#FFFFFF</color>
{SDCard Dir}/Android/data/{packageName}/files/recovery_crash/
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.