Package io.sentry.util.thread
Class MainThreadChecker
java.lang.Object
io.sentry.util.thread.MainThreadChecker
- All Implemented Interfaces:
IMainThreadChecker
Class that checks if a given thread is the Main/UI thread. The Main thread is denoted by the
thread, where the `Sentry.init` method was called. If it was inited from a background thread,
then this class is wrong, but it's a best effort.
We're gonna educate people through the docs.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MainThreadCheckerbooleanChecks if the calling/current thread is the Main/UI threadbooleanisMainThread(long threadId) booleanisMainThread(@NotNull SentryThread sentryThread) Checks if a given thread is the Main/UI threadbooleanisMainThread(@NotNull Thread thread) Checks if a given thread is the Main/UI thread
-
Method Details
-
getInstance
-
isMainThread
public boolean isMainThread(long threadId) - Specified by:
isMainThreadin interfaceIMainThreadChecker
-
isMainThread
Description copied from interface:IMainThreadCheckerChecks if a given thread is the Main/UI thread- Specified by:
isMainThreadin interfaceIMainThreadChecker- Parameters:
thread- the Thread- Returns:
- true if it is the main thread or false otherwise
-
isMainThread
public boolean isMainThread()Description copied from interface:IMainThreadCheckerChecks if the calling/current thread is the Main/UI thread- Specified by:
isMainThreadin interfaceIMainThreadChecker- Returns:
- true if it is the main thread or false otherwise
-
isMainThread
Description copied from interface:IMainThreadCheckerChecks if a given thread is the Main/UI thread- Specified by:
isMainThreadin interfaceIMainThreadChecker- Parameters:
sentryThread- the SentryThread- Returns:
- true if it is the main thread or false otherwise
-