fix crash in PushNotificationUtils when theres no google play services
This commit is contained in:
+6
-1
@@ -1,5 +1,6 @@
|
|||||||
package com.vitorpamplona.amethyst.service.notifications
|
package com.vitorpamplona.amethyst.service.notifications
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import com.google.firebase.messaging.FirebaseMessaging
|
import com.google.firebase.messaging.FirebaseMessaging
|
||||||
import com.vitorpamplona.amethyst.AccountInfo
|
import com.vitorpamplona.amethyst.AccountInfo
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -12,6 +13,10 @@ object PushNotificationUtils {
|
|||||||
return@with
|
return@with
|
||||||
}
|
}
|
||||||
// get user notification token provided by firebase
|
// 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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user