Context-aware computing has been the center of attention in computer science research for many years. Context-aware systems gather contextual data from their sensors, other cooperative nodes or persistent databases and adapt to this information without requiring explicit user intervention. In this thesis we first address the benefits of certain contextual data (such as network connectivity, communication bandwidth, cost of operation, user's location, as well as nearby people and objects) applied to wireless networks. Other important contextual data include social surrounding, environment related conditions, and time context (time of day, month, season, or year). As a result of advancements in technology, the accessing, storing, and incorporating of such massive amounts of data has become a mainstream service. We then develop active and passive localization algorithms for wireless networks. This thesis emphasizes context-aware models for the network layer of wireless and cellular networks rather than classical application layer context-awareness. We first propose a mobile client based active queue management technique which remotely controls the dedicated base station queue size significantly reducing the experienced packet latency. Here, mobile makes use of its knowledge of the underlying cellular technology to enhance the end user experience. We then introduce a packet size aware path setup mechanism for wireless mesh networks where routers benefit from packet size information in computing the optimal route. Both techniques are implemented on real hardware; implementation details and practical considerations are also provided. The second part of this thesis focuses on locating a target in wireless networks. First, we propose a localization algorithm that uses the multipath profile of a mobile device in a cellular network. This algorithm is implemented and evaluated using real data from a commercial cellular network. Finally, we provided linear least squares and neural network techniques for active and passive localization algorithms in a sensor network. The term active localization indicates that the target is active in the localization process, while passive localization refers to locating an uncooperative target