A Wireless Sensor Network (WSN) is a collection of sensors connected through a wireless infrastructure and is primarily used to collect data in a given environment. In their early phase of existence, WNSs were mostly homogeneous devices with low computational capabilities assigned simple tasks like gathering information about temperature or humidity in large fields or remote locations. Recently, WSNs have been evolving rapidly and have transformed into employing clever devices capable of performing complex tasks in smart environments. Future WSNs are likely to consist of heterogeneous sensors embedded in many objects performing various types of tasks that are far more advanced than simple data collection. The emergence of the Internet of Things (IoT) represents a typical example of evolved WSNs, in which WSNs include sensors embedded in a variety of 'things' in a variety of environments such as homes, factories, vehicles, and hospitals. Traditional network management approaches, designed to manage simple uniform sensor networks, are no longer appropriate to deal with such complex networks. In this work, we propose a new approach for managing heterogeneous WSNs designed to accommodate variabilities associated with different environments. The proposed approach is implemented using genetic algorithms to achieve the flexibility needed to optimize different types of objective functions such as quality of coverage, redundancy and energy-awareness. We report the results of employing the proposed approach under different scenarios with different sets of assumptions and priorities for typical application domains. For assessment purposes, we compare our algorithm with two greedy algorithms used to manage WSNs in different applications. The proposed algorithm performs better than other methods and exhibits the ability to adjust to the different needs of each scenario.