With the increasing popularity of smartphones and netbooks, more and more applications are developed for the mobile platform. Notwithstanding the recent advances in mobile hardware, most mobile devices still lack sufficient resources (e.g. CPU power, memory) to execute complex multimedia applications such as augmented reality. Application developers also have difficulties to cope with the changing device context (e.g. network connectivity, remaining battery life) and the many different hardware platforms and operating systems to run applications on. Therefore, we introduce the concept where the developer can provide different configurations of an application, each having different resource requirements and a different quality offered to the end user. The middleware framework presented in this paper will select and deploy the configuration offering the best quality possible for the current connectivity and available resources. As these change over time, the framework will dynamically adapt the configuration and deployment at runtime, enhancing the quality by offloading parts of the application when a remote server is discovered, or gracefully degrading the quality when the network connection is lost. Based on experimental results on the augmented reality use case the performance and effectiveness of our middleware has been characterized in different scenarios.