Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block app start if appLaunchedInForeground is not set. #2291

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- Blocking app starts if "appLaunchedInForeground" is false. (Android only) ([#2291](https://github.com/getsentry/sentry-dart/pull/2291)

### Enhancements

- Improve app start integration ([#2266](https://github.com/getsentry/sentry-dart/pull/2266))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SentryFlutter(
}
data.getIfNotNull<String>("diagnosticLevel") {
if (options.isDebug) {
val sentryLevel = SentryLevel.valueOf(it.toUpperCase(Locale.ROOT))
val sentryLevel = SentryLevel.valueOf(it.uppercase(Locale.ROOT))
options.setDiagnosticLevel(sentryLevel)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {

val appStartMetrics = AppStartMetrics.getInstance()

if (!appStartMetrics.isAppLaunchedInForeground) {
stefanosiano marked this conversation as resolved.
Show resolved Hide resolved
Log.w("Sentry", "App not launched in Foreground")
martinhaintz marked this conversation as resolved.
Show resolved Hide resolved
result.success(null)
}

val appStartTimeSpan = appStartMetrics.appStartTimeSpan
val appStartTime = appStartTimeSpan.startTimestamp
val isColdStart = appStartMetrics.appStartType == AppStartMetrics.AppStartType.COLD
Expand Down
Loading