This commit is contained in:
Philipp Heckel 2021-11-05 20:25:02 -04:00
parent 4513b9963e
commit a51c856d4c
2 changed files with 12 additions and 1 deletions

View file

@ -66,6 +66,7 @@ class MessagingService : FirebaseMessagingService() {
override fun onNewToken(token: String) {
// Called if the FCM registration token is updated
// We don't actually use or care about the token, since we're using topics
Log.d(TAG, "Registration token was updated: $token")
}
override fun onDestroy() {

View file

@ -100,7 +100,17 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback {
lastActive = Date().time/1000
)
viewModel.add(subscription)
FirebaseMessaging.getInstance().subscribeToTopic(topic) // FIXME ignores baseUrl
FirebaseMessaging
.getInstance()
.subscribeToTopic(topic)
.addOnCompleteListener {
Log.d(TAG, "Subscribing to topic complete: result=${it.result}, exception=${it.exception}, successful=${it.isSuccessful}")
}
.addOnFailureListener {
Log.e(TAG, "Subscribing to topic failed: $it")
}
// FIXME ignores baseUrl
onSubscriptionItemClick(subscription) // Add to detail view after adding it
}