diff --git a/app/src/standard/java/com/infomaniak/mail/StandardPlayServicesUtils.kt b/app/src/standard/java/com/infomaniak/mail/StandardPlayServicesUtils.kt index c6be8eb7c7..49b97137d8 100644 --- a/app/src/standard/java/com/infomaniak/mail/StandardPlayServicesUtils.kt +++ b/app/src/standard/java/com/infomaniak/mail/StandardPlayServicesUtils.kt @@ -72,9 +72,11 @@ class StandardPlayServicesUtils @Inject constructor( FirebaseMessaging.getInstance().token.addOnCompleteListener { task -> if (!task.isSuccessful) { - Sentry.withScope { scope -> - scope.setExtra("task.exception", task.exception.toString()) - Sentry.captureMessage("Fetching FCM registration token failed", SentryLevel.ERROR) + if (task.exception?.message?.contains(SERVICE_NOT_AVAILABLE_EXCEPTION) != true) { + Sentry.withScope { scope -> + scope.setExtra("task.exception", task.exception.toString()) + Sentry.captureMessage("Fetching FCM registration token failed", SentryLevel.ERROR) + } } SentryLog.w("firebase", "Fetching FCM registration token failed", task.exception) return@addOnCompleteListener @@ -92,4 +94,8 @@ class StandardPlayServicesUtils @Inject constructor( registerUserDeviceWorkerScheduler.scheduleWork() } } + + companion object { + const val SERVICE_NOT_AVAILABLE_EXCEPTION = "SERVICE_NOT_AVAILABLE" + } }