Developing a distributed application for mobile resource constrained devices is a difficult and error-prone task that requires awareness of several system-level details (e.g., fault-tolerance, ...). Several mobile middleware solutions addressing these issues have been proposed. However, they rely on either significant changes in application structure, extensions to the programming language syntax and semantics, domain specific languages, cumbersome development tools, or a combination of the above. The main disadvantages of these approaches are lack of transparency and reduced portability. In this paper we describe our work on enabling transparent integration between applications and middleware without changing application structure, extending the programming language or otherwise reducing portability. We used the OBIWAN middleware but our solutions are general. To achieve this goal we employ program analysis and transformation techniques for extending application code with hooks for ca...