3

I want to send client FCM token to my server when the token is ready, so I need my user repository in MyFirebaseMessagingService.

The problem is FirebaseMessagingService needs default empty constructor. So How can inject my userRepo in the MyFirebaseMessagingService class? I'm using Koin as dependency injection

FarshidABZ
  • 3,860
  • 4
  • 32
  • 63

1 Answers1

5

I found my answer:

class FCMService: FirebaseMessagingService(), KoinComponent {
  private val userRepository: UserRepository by inject()
  ...
}
FarshidABZ
  • 3,860
  • 4
  • 32
  • 63