Use the AdWhirl technology to display ads from different ad networks in your Android and iPhone applications. But the original Project depend on Amazon EC2 environment. With the source code available, you can see how it works in your local server. This is the original Adwhirl project.