I only get bugs when there is bruised or rotting fruit in my house. As long as all the skins are intact and nothing is getting past its prime, there are no flies. But they seem to appear the moment something is there for them!
1) Get a glass jar, put some very ripe or rotting fruit in it.
2) Get a piece of paper, form a cone with a small hole on one end and a big one on the other (use scissors and sticky tape). Put it on the jar, the small hole downwards. Make sure the paper fits the jar tightly.
3) Put the jar near the place you keep your fruit. Observe. The flies go after the fruit in the jar, and have no problems going through the large hole into the cone and then through the small hole into the jar. The other way however, their brain power is insufficient to work out the exit algorithm and they get stuck.
4) Every couple of days or so take the jar outside and release the flies. If you don't, they will have babies inside the jar, and you will notice them crawling around.
if you're not afraid of killing them, you can make a pretty great trap by using apple cider vinegar, sugar and dish soap. many of us do not have these products on hand so it's a bit of a pain to buy them...anyway, put these three ingredients in a dish and stir. set it near your fruit and the flies cannot resist the smell of sugar and vinegar. the soap traps them in the solution.
i have also used the cone method...it works pretty good too.