Here are tips about fruit flies here, as I had lots all the time last year. One, I figured out the ones I had came from the food co-op and sometimes from a loved one who brought not so new vegetables, which I threw away, but which had fruit flies in them. They lasted all summer. Then we got fed up and looked on the internet for how to get rid of them. We experimented with different combinations and found some good ones.
How to get rid of fruit flies:
1- Get out 2 tiny glass glass dessert bowls, some clear plastic wrap and a cake tester, large, thick needle or large, thick safety pin.
2- In one bowl, put not canned, but fresh peaches. Peal the peaches. Cut them up. They love this best of all fruits. Cover the peaches with the plastic wrap and poke tiny holes in the cover large enough for the fruit flies to get into. If the holes are too big and they fly out, cover again and poke tinier holes, leaving the first cover on still. This double traps them, which may even be something to just start off with, because some of them are clever and find a way out.
3- In the 2nd bowl, make a mix of half an avocado, a bit of salsa, some mustard and a whole lot of garlic. Add some ketchup. Mix it up and it will smell awesome to the fruit flies. They love all of these things. Combined? WOWZA!!! Then cover it and poke holes as you did in number 2. Leave them out in the kitchen.
4- Wait. Patience. Just ignore them and come back in a day. When they are full enough to make you feel like that is enough, take them out ti the back yard and fill the bowls up with water. Leave them an hour, then go out and dump it all out into a trash bag, tie it up and either double/ triple tie up the bag in trash bag after trash bag, or go back inside and dispose of it into the toilet or down the sink disposal. If you do that, run the water and disposal immediately to get it all out of there.
5- Repeat 1-4 until they are all gone. Get a fly swatter, too, and have your husband make it his duty to whack them. This will get rid of the remaining ones, who are likely the experts at getting in and gettting out, or finding foods they like which are not in a trap.
6- Favorites for fruit flies are juices in a juice container that is used and left out, not rinsed, ketchup, salsa, barbecue sauce, tomato soup, rotten fruit, any kind of lettuce or green leaf item, garlic, mustard and avocado. If you leave any of this out, they will eat it and this helps them to reproduce. Try during steps 1-4 to cover any of this you do not have time to rinse, with plastic wrap.
7- If we used a juice container up and did not have time to wash it, we filled it with water and covered it with its lid. This was awesome, as many fruit lies drowned in there. It was always better just to wash and keep things clean, of course.
8- If you have fresh fruits and veggies out a lot, constantly check the fruit and veggie bowls for not-so fresh, past prime fruits or veggies and get them into a covered garbage can with a garbage sack in it. Tie up garbage sacks well when you take them out to the outside trash bin.
9- Try with all your might to keep the kitchen, dining room and dishes clean.