I have an application where i want to trigger a notification , notification data comes from an api request , i'm using mvvm pattern with which i'm injecting the viewmodel using dagger-hilt , it works well in my activities and fragments but when i tried to inject it into my broadcast receiver , it is not working and i don't know what is actually wrong with the code , any help is appreciated guys , thank you .
- This is the code
@AndroidEntryPoint
class AlarmReceiver : BroadcastReceiver () {
@Inject lateinit var leagueViewModel : LeagueViewModel
override fun onReceive(context: Context?, intent: Intent?) {
AlarmHelper.setAlarm(context!!)
if(Constants.checkConnectivity(context)){
if(intent?.action == "intent.action.android.games"){
//Using the viewmodel insid this function to get data from api
fireGameNotification(context,leagueViewModel)
}
}
}
- This is the error occuring
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution