Every once in awhile, I've had fruit flies - the tiny ones, buzzing around when a piece of fruit became over-ripe in the kitchen. So you toss out the fruit, and the irritating little fruit flies hang around forever, near the sink, on bright colored objects, only to rise in a swarm when you go near their "roost" for lack of a better term.
I found a cheap, simple way to get rid of them, and it really does work, I've tried it.
Take an old spagetti sauce, or pickle jar, preferably with a brightly colored lid. (mine is bright yellow) ..... Clean it well. Then use a nail, punch, screw, or whatever is handy to punch several holes in the lid just a little larger than a fruit fly.
Put a few inches of apple cider vinegar in the bottle. (and it must be apple cider vinegar, not white, etc.....) Screw the lid on. Place it near wherever the little pests are congregating. That's it. The little pests are attracted by the smell of the vinegar (they think rotting apples, I suppose?) go thru the little holes into the jar after the smell, get dizzy from the fumes, fall into the vinegar and drown.
Simple, cheap, no chemicals, and it works. Hope the pic of the little buggers in the jar isn't too offensive or gross, just showing that it does work.