Koin: How to inject a repo into FirebaseMessagingService class

Created on 25 Mar 2019  路  2Comments  路  Source: InsertKoinIO/koin

Hi
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?

question

Most helpful comment

class FCMService: FirebaseMessagingService(), KoinComponent {
  private val userRepository: UserRepository by inject()
  ...
}

All 2 comments

class FCMService: FirebaseMessagingService(), KoinComponent {
  private val userRepository: UserRepository by inject()
  ...
}

seems to be ok

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CristianMG picture CristianMG  路  3Comments

caleb-allen picture caleb-allen  路  4Comments

luna-vulpo picture luna-vulpo  路  4Comments

AHarazim picture AHarazim  路  3Comments

sankarsana picture sankarsana  路  4Comments