The Android Arsenal: Registration
Documentation
Facility
Step 1. Add the JitPack repository to your construct file.
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency.
dependencies {
implementation 'com.github.rommansabbir:TraceX:Tag'
}
accessible model
Why TraceX?
TraceX
is designed to watch all uncaught exception it happens within the software lifecycle by default. As well as, the shopper can disable computerized monitoring uncaught exception following the TraceXConfig
and manually register a Exercise
to watch calling TraceX.registerActivity
API.
TraceX
will mechanically write a document to the applying cache listing if the uncaught exception is an occasion of RuntimeException
based mostly on Config
. The shopper can even write a brand new document to the applying cache listing by calling TraceX.writeANewLog
API.
As well as, the shopper can receive all of the data written by TraceX
or the shopper himself calling TraceX.writeANewLog
API.
The shopper can even take away a listing of managed or unmanaged data from the cache listing written by TraceX
. Or simply take away all cache listing data written by TraceX
.
Motto of this library:
As a developer, we do not know on what system or what system of restrictions will probably be launched on. Exception
both RuntimeException
if the applying is in PRODUCTION. if any uncaught exception occurs through the life cycle of the applying, we discover out about it from others log library.
However, as a developer, you may want the consumer to navigate to a selected web page (eg the house web page) when a deadly exception happens that finally kills the app course of on the system. Earlier than the navigation of that web page, we will write a document to the applying cache listing by following the Present system data, Present Thread, Throwable that occurred, and a JSON object as extra data. Or just, we will write our personal document to the cache listing on our personal.
In order that we will get the checklist of logs written from the cache listing when the consumer runs the app once more, we will course of the logs, like SEND IT TO THE REMOTE SERVER for bug fixing, evaluation, or just ignoring or eradicating the cache listing log.
NOTE: Cache listing write or learn data comply with the encryption/decryption course of utilizing StoreX.
How you can initialize and entry?:
Initialize TraceX
out of your Utility.onCreate()
TraceXProvider.register(TraceXConfig(this,
autoRegisterForEachActivity = true,
autoLogRuntimeExceptions = true
))
To entry TraceX
to name TraceXProvider.INSTANCE
which return an occasion of TraceX
Public APIs:
-
registerListener(listener: TraceXCallback?)
To register or unregister a listener -
registerActivity(exercise: Exercise?): Boolean
Manually register an exercise for dealing with uncaught error occasions and return itBoolean
. Additionally,TraceXConfig.autoRegisterForEachActivity
It needs to befalse
-
writeANewLog(throwable: Throwable, additionalInfo: String = ""): Boolean
To jot down a brand new encrypted document to the applying cache listing and returnBoolean
. -
getRecentCrashLogs(): MutableList<TraceXCrashLog>
To get a listing of current data from the applying cache listing. [Note: It’s a CPU Intensive process, execute the operation with Coroutine/RxJava.] -
clearCrashLogs(checklist: MutableList<TraceXCrashLog>)
To delete a given checklist ofTraceXCrashLog
from the applying cache listing. [Note: It’s a CPU Intensive process, execute the operation with Coroutine/RxJava.] -
clearAllLogs(): Boolean
To delete all software cache listing data written by **TraceX
[Note: It’s a CPU Intensive process, execute the operation with Coroutine/RxJava.]
Keep in mind: all public APIs will generate TraceXNotInitializedException
Sure TraceX
will not be initialized earlier than accessing su APIs
.
Checkout the pattern app for the implementaion intimately
Blissful coding….
Contact me
License
Copyright (C) 2022 Romman Sabbir
Licensed beneath the Apache License, Model 2.0 (the "License");
chances are you'll not use this file besides in compliance with the License.
You might receive a replica of the License at
http://www.apache.org/licenses/LICENSE-2.0
Except required by relevant regulation or agreed to in writing, software program
distributed beneath the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, both categorical or implied.
See the License for the particular language governing permissions and
limitations beneath the License.