tags:

views:

371

answers:

6

We have an Adobe AIR application which could be possibly downloaded from multiple domains. And when it's run, it should connect back to the site it was downloaded from to get data to show to the user.

So far we have a separate application build for each domain with a site URL hardcoded into it. And I wonder is there a way for AIR application to find out at runtime the URL (or at least domain) from which it was downloaded?

What we would like to have is a single downloadable binary served from all different domains, which still can know it's origin URL.

+1  A: 

How should this work? The only solution i see (independent from AIR) is that you deliver an extra (properties) file with the application, containing the URL downloaded from. So you dont need to build a separate app for each domain, but only package a different domain-file with it. The app then reads this file and executes some context sensitive stuff.

Mork0075
Well, the problem is AIR-specific, as the AIR application is a single signed file. So there is no difference between "build a separate app" and "package a different domain-file with it". The point of the question is to have a single downloadable binary, which still can know it's origin URL.
Maxim
Cant you access files from within AIR? Althogh the AIR app is a single file, you can package it in a zip file. The user extracts it into the filesystem, along with a properties.txt file on the same filesystem level.
Mork0075
But Air apps download as apps not zips for example, so external files won't work, you need a build per deployment as Theo T. suggested
Robert Gould
+2  A: 

There's no direct way to do it.

Here are some options which come in mind:

  • Build different versions for each site (this could be automated)
  • Let user choose the site at first launch
  • Try to guess it using using whatever resources you have (timezone, language, etc)
Maiku Mori
A: 

When the user downloads, you could store their IP address in your central DB. Then when the app is installed and runs the first time, the app could hit your central DB to match up their IP address with the server they downloaded from.

Nathan DeWitt
Unless their IP changes, or they mail a copy to a friend, or...Sorry but this is not a viable solution
Robert Gould
A: 

A cookie with a specific name being stored on a download page, and the AIR app looking for that? Though that might not work for direct downloads. It might also be hard to pull off since knowing the specific browser used to download it would be an issue.

JMV
You can't poke into cookies on the users system from an AIR application.
Vasil
+3  A: 

There's no function to retrieve such information, it would just make no sense if you think about it.

The most stable way is to include an external configuration file into the package.

Note that you can use ANT to automate this process for this final deployment.

Theo.T
Specialized builds is viable solution
Robert Gould
A: 

how to know the P address of the system in which the AIR application is currently running? or

how to restrict the usage of AIR application for a particular country?

shaffiullah khan

related questions