Run a quarter inch stream of table salt around the edges of the shower floor and pour 1/4 cup of salt in the drain after the last shower every day for three or four days.
If the "why" is important to you, here are four things you need to know:
1)Bleach does not kill the eggs and in weaker concentrations is actually an attractant! Ditto vinegar.
2)Very hot water will kill the eggs and table salt kill the larvae.
3)Larvae are more as likely to live in the cracks of mortar base between the tile and the shower pan as in the drain.
4)The life cycle of the sewer flies is about one week.