Install App if not installed through a URL?



I was wondering if anyone could help me with the following question regarding launching and installing an app through a URL.
Currently, I have an appliication that uses : and it is able to launch the application to a given URI scheme. However, I wanted to have the following use case:

  • There is no app installed and going to the url would redirect it to the market and install the application (after installing it would pass the id 10 to the application)
  • There is app installed and going to the url and it would open the app with param 10 (currently this is handled using the URI scheme).

Has anyone done something similar to my first use case?

Kind Regards