From 2a8d7ad10d3375d109fbf360606275bf04d612cf Mon Sep 17 00:00:00 2001 From: Bhuvaneshwaran <68098126+Bhuvaneshw@users.noreply.github.com> Date: Wed, 4 Sep 2024 19:10:26 +0530 Subject: [PATCH] Update README.md --- README.md | 70 +++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 09ee792..b4b0f21 100644 --- a/README.md +++ b/README.md @@ -25,50 +25,50 @@ A Crash Handling library for Android projects that automatically stores all cras ### 1.1 Gradle - Kotlin DSL Step 1: Project level build.gradle.kts / settings.gradle.kts -
+``` dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() - maven("https://jitpack.io") + maven("https://jitpack.io") } } -+``` Step 2: Module level build.gradle
+``` dependencies { - implementation("com.github.Bhuvaneshw:CrashHandler:$version") + implementation("com.github.Bhuvaneshw:CrashHandler:$version") } -+``` Replace $version with latest version
+``` dependencies { - implementation("com.github.Bhuvaneshw:CrashHandler:1.0.0") + implementation("com.github.Bhuvaneshw:CrashHandler:1.0.0") } -+``` ### 1.2 Gradle - Groovy DSL Step 1: Project level build.gradle / settings.gradle -
+``` dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() - maven { url 'https://jitpack.io' } + maven { url 'https://jitpack.io' } } } -+``` Step 2: Module level build.gradle
+``` dependencies { - implementation 'com.github.Bhuvaneshw:CrashHandler:$version' + implementation 'com.github.Bhuvaneshw:CrashHandler:$version' } -+```
+``` class MyApp : CrashHandlerApplication() { init { installCrashHandler() @@ -92,11 +92,11 @@ class MyApp : CrashHandlerApplication() { //) } } -+```
+``` public class MyApp extends CrashHandlerApplication { @Override public void onCreate() { @@ -107,16 +107,16 @@ public class MyApp extends CrashHandlerApplication { //initCrashHandler(Thread.currentThread(), DefaultErrorMessageFormatter.INSTANCE, new RestartAppCallback(this), new AndroidErrorLogger()); } } -+```
+``` <application android:name=".MyApp" ...> ... </application> -+```
+``` class MyApp : CrashHandlerApplication() { init { - installCrashHandler(callback = RestartAppCallback(this)) + installCrashHandler(callback = RestartAppCallback(this)) } } -+```
+``` public class MyApp extends CrashHandlerApplication { @Override public void onCreate() { @@ -158,12 +158,12 @@ public class MyApp extends CrashHandlerApplication { initCrashHandler( Thread.currentThread(), DefaultErrorMessageFormatter.INSTANCE, - new RestartAppCallback(this), + new RestartAppCallback(this), new AndroidErrorLogger() ); } } -+```
+``` class CustomCrashHandlerApp : CrashHandlerApplication() { init { @@ -183,11 +183,11 @@ class CustomCrashHandlerApp : CrashHandlerApplication() { } } -+```
+``` public class DefaultCrashHandlerApp extends CrashHandlerApplication { @@ -203,7 +203,7 @@ public class DefaultCrashHandlerApp extends CrashHandlerApplication { } } -+```
+``` val log: ErrorLog = crashHandler.loadErrorLog() val errors: MutableList+``` > [!TIP] > Using coroutine with IO dispatcher is recommended? = log.errors val simplifiedLog: String = log.simplifiedLog() val lastErrorTime: String? = log.lastErrorTime -
+``` ErrorLog log = CrashHandlerUtilsKt.getCrashHandler(context).loadErrorLog(); //Works only when the context.applicationContext is an instance of CrashHandler, //i.e The application must implement CrashHandler, like extending CrashHandlerApplication List+``` ## 3. Custom Crash Handler UIerrors = log.getErrors(); String simplifiedLog = log.simplifiedLog(); String lastErrorTime = log.getLastErrorTime(); -