Skip to content

Commit

Permalink
Fix app start spans missing from Pixel devices (#3634)
Browse files Browse the repository at this point in the history
* added post on main thread to post check on main thread
  • Loading branch information
stefanosiano authored Aug 12, 2024
1 parent 19d98e8 commit 32eed6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Fixes

- Fix app start spans missing from Pixel devices ([#3634](https://github.com/getsentry/sentry-java/pull/3634))
- Avoid ArrayIndexOutOfBoundsException on Android cpu data collection ([#3598](https://github.com/getsentry/sentry-java/pull/3598))
- Fix lazy select queries instrumentation ([#3604](https://github.com/getsentry/sentry-java/pull/3604))
- Session Replay: buffer mode improvements ([#3622](https://github.com/getsentry/sentry-java/pull/3622))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ public void registerApplicationForegroundCheck(final @NotNull Application applic
isCallbackRegistered = true;
appLaunchedInForeground = appLaunchedInForeground || ContextUtils.isForegroundImportance();
application.registerActivityLifecycleCallbacks(instance);
// We post on the main thread a task to post a check on the main thread. On Pixel devices
// (possibly others) the first task posted on the main thread is called before the
// Activity.onCreate callback. This is a workaround for that, so that the Activity.onCreate
// callback is called before the application one.
new Handler(Looper.getMainLooper()).post(() -> checkCreateTimeOnMain(application));
}

private void checkCreateTimeOnMain(final @NotNull Application application) {
new Handler(Looper.getMainLooper())
.post(
() -> {
Expand Down

0 comments on commit 32eed6a

Please sign in to comment.