They will only hang around rotting fruit, just make sure your fruit is fresh and thoroughly clean the bowl!! you may think its clean but the flies will find small traces.
I have been told not to keep bananas with other fruit as well because the enzymes in the bananas will turn the other fruit really quickly! (dont know how true that is!)