From 453e63025d89c455f656760c8514a3a518b09260 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Mon, 21 Aug 2023 15:58:01 -0300 Subject: [PATCH] fix crash in PushNotificationUtils when theres no google play services --- .../service/notifications/PushNotificationUtils.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationUtils.kt b/app/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationUtils.kt index 533863da5..c9cee7d9f 100644 --- a/app/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationUtils.kt +++ b/app/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationUtils.kt @@ -1,5 +1,6 @@ package com.vitorpamplona.amethyst.service.notifications +import android.util.Log import com.google.firebase.messaging.FirebaseMessaging import com.vitorpamplona.amethyst.AccountInfo import kotlinx.coroutines.Dispatchers @@ -12,6 +13,10 @@ object PushNotificationUtils { return@with } // get user notification token provided by firebase - RegisterAccounts(accounts).go(FirebaseMessaging.getInstance().token.await()) + try { + RegisterAccounts(accounts).go(FirebaseMessaging.getInstance().token.await()) + } catch (e: Exception) { + Log.e("Firebase token", "failed to get firebase token", e) + } } }