Preventing fruit flies is really going to come down to sanitation. Fruit flies can sense decaying organic matter and will come in quickly when any is detected. By following the sanitation outlined in the Fruit Fly Treatment section you can keep fruit flies at bay.
Be sure all produce is washed when it is brought inside to remove any existing fruit fly eggs. Do not store produce for long periods of time as this will attract fruit flies.
In homes and businesses where fruit flies have been a consistent problem, it is recommended that an insect growth regulator be applied once every 30 days to help break the infestation cycle. Insect growth regulators stop immature fruit flies from being able to form into breeding adults. Insect growth regulators come in concentrated liquids and ready to use aerosols and are usually applied to cracks and crevices in infested rooms.