You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// JustBeforeLaunchAlarmReceiver
repository.getNextLaunch()
.first()
.invoke()
.takeIf { it !=null&& it.tentativeMaxPrecision ==DatePrecision.hour }
?:run {
log("Could not get next launch from database. Not scheduling notification")
return
}
Broadcast receivers for Launch alarms use the first item received in the Flow<Resource<Launch> or Flow<Resource<List<Launch>> for showing the notifications. This first item is always Resource.Loading.
Hence the invoke() operator always produces null and notifications are never scheduled.
Solution
Change the call from first() to last().
The text was updated successfully, but these errors were encountered:
Problem
Broadcast receivers for Launch alarms use the first item received in the
Flow<Resource<Launch>
orFlow<Resource<List<Launch>>
for showing the notifications. This first item is alwaysResource.Loading
.Hence the
invoke()
operator always produces null and notifications are never scheduled.Solution
Change the call from
first()
tolast()
.The text was updated successfully, but these errors were encountered: