public final class PlanB
extends java.lang.Object
This is the main API of the library.
Note: if the app crashes with an unhandled exception, all classes
will lose their state. So any code executed after handling he exception
will be called with a new Application object.
| Modifier and Type | Method and Description |
|---|---|
static RecoverBehaviorFactory |
behaviourFactory() |
static CrashDataHandlerFactory |
crashDataHandlerFactory() |
void |
disableCrashHandler()
Disables the defined crash handler and sets the default one.
|
void |
enableCrashHandler(android.content.Context context,
CrashRecoverBehaviour behaviour)
Enables the crash handling logic, setting the config and behaviour.
|
void |
enableCrashHandler(android.content.Context context,
CrashRecoverBehaviour debugCrashBehaviour,
CrashRecoverBehaviour releaseCrashBehaviour)
Enables the crash handling logic, setting the config and behaviour.
|
static PlanB |
get()
Gets an instance of the singleton
|
PlanBConfig |
getConfig()
PlanB must be
init(Context) before this can be called |
CrashDataHandler |
getCrashDataHandler()
Get the current crash data handler implementation.
|
void |
init(boolean debugBuild,
PlanBConfig config)
Init the library.
|
void |
init(android.content.Context context)
Init the library.
|
void |
init(android.content.Context context,
boolean debugBuild)
Init the library.
|
boolean |
isDebugBuild()
Returns the value passed or (or gathered) during
init(Context, boolean) |
static PlanBConfig.Builder |
newConfig(android.content.Context context)
Creates a new config builder
|
public static RecoverBehaviorFactory behaviourFactory()
public static CrashDataHandlerFactory crashDataHandlerFactory()
public static PlanBConfig.Builder newConfig(android.content.Context context)
context - public static PlanB get()
public void init(android.content.Context context)
CrashDataHandler. Internally checks the manifest
if this is an debuggable build.context - public void init(android.content.Context context,
boolean debugBuild)
CrashDataHandler.context - debugBuild - if this is a debug or release build; usually BuildConfig.DEBUG is the correct boolean to pass herepublic void init(boolean debugBuild,
PlanBConfig config)
CrashDataHandler.debugBuild - if this is a debug or release build; usually BuildConfig.DEBUG is the correct boolean to pass hereconfig - configure versions and build info aswell as crash handlerpublic void enableCrashHandler(android.content.Context context,
CrashRecoverBehaviour behaviour)
This method will set itself as Thread.getDefaultUncaughtExceptionHandler()
so be aware if you have other crash reporting frameworks like HokeyApp, Crashlytics
or ACRA.
This call requires that init(Context, boolean) was called first.
behaviour - what exactly to do when a crash occurscontext - see newConfig(Context)public void enableCrashHandler(android.content.Context context,
CrashRecoverBehaviour debugCrashBehaviour,
CrashRecoverBehaviour releaseCrashBehaviour)
This method will set itself as Thread.getDefaultUncaughtExceptionHandler()
so be aware if you have other crash reporting frameworks like HokeyApp, Crashlytics
or ACRA.
This call requires that init(Context, boolean) was called first.
debugCrashBehaviour - behaviour for debug buildsreleaseCrashBehaviour - behaviour for release buildscontext - see newConfig(Context)public void disableCrashHandler()
public boolean isDebugBuild()
init(Context, boolean)public CrashDataHandler getCrashDataHandler()
public PlanBConfig getConfig()
init(Context) before this can be called