You must be eliminated before the end of the round.
Text from Constable:
If this card is in your discard pile when you are knocked out of the round, gain an Affection Token.
(Emphasis mine)
In the rulebook for the original Love Letter, the phrase "knocked out of the round" is used several times, and in each case it is only referring to being eliminated while the round is still going. Example:
If you discard the Princess—no
matter how or why—she has tossed
16
your letter into the fire. You are
knocked out of the round.
(Emphasis mine)
Under the rules for "End of a round", no mention is made of being knocked out:
The player with the
highest ranked person wins the
round.
So being "knocked out of a round" is something that specifically happens from the effects of a card that was discarded.