Как вставить FCM в базу данных комнат? - PullRequest
0 голосов
/ 26 октября 2019

я пытаюсь вставить данные fcm в базу данных комнат, но это не вставка, это код, который я пытаюсь использовать в моей FirebaseMessagingService

class NotificationService : FirebaseMessagingService() {
 lateinit var db: NotificationDao
 override fun onMessageReceived(remoteMessage: RemoteMessage) {
    db = PrefDatabase.getInstance(applicationContext).NotificationDao() // getInstance is a companion object  fun in PrefDatabase

     if (remoteMessage.notification != null) {

         showNotification(remoteMessage)
     }
 private fun showNotification(remoteMessage: RemoteMessage) {
        ........
        .....
      //Saving 
     Thread {
         val notifi =Notifi(remoteMessage.notification.title, remoteMessage.notification.body)
         db.insertNotification(notifi)
     }.start()
 }
}


}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...